-
Notifications
You must be signed in to change notification settings - Fork 15.3k
[AArch64][Build Attributes] Improve Parsing and Formatting #126530
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
@llvm/pr-subscribers-mc @llvm/pr-subscribers-backend-aarch64 Author: SivanShani-Arm (sivan-shani) ChangesWhen adding build attributes from assembly, an existing value should not trigger an assertion. This case is valid, and behavior should remain consistent between builds with and without assertions. Full diff: https://github.com/llvm/llvm-project/pull/126530.diff 2 Files Affected:
diff --git a/llvm/lib/Target/AArch64/MCTargetDesc/AArch64TargetStreamer.cpp b/llvm/lib/Target/AArch64/MCTargetDesc/AArch64TargetStreamer.cpp
index 1ed4a81a9767390..d4081e606448b4b 100644
--- a/llvm/lib/Target/AArch64/MCTargetDesc/AArch64TargetStreamer.cpp
+++ b/llvm/lib/Target/AArch64/MCTargetDesc/AArch64TargetStreamer.cpp
@@ -222,13 +222,9 @@ void AArch64TargetStreamer::emitAttribute(StringRef VendorName, unsigned Tag,
"Can not add AArch64 build attribute: An attribute with "
"the same tag and a different value already exists");
return;
- } else {
- // Case Item.IntValue == Value, no need to emit twice
- assert(0 &&
- "AArch64 build attribute: An attribute with the same tag "
- "and a same value already exists");
- return;
}
+ // Case Item.IntValue == Value, no need to emit twice
+ return;
}
}
}
diff --git a/tests.sh b/tests.sh
new file mode 100755
index 000000000000000..182932267a6cdbf
--- /dev/null
+++ b/tests.sh
@@ -0,0 +1,11 @@
+${binrl}/llvm-lit -v llvm/test/MC/AArch64/aarch64-build-attributes-asm-*
+${binral}/llvm-lit -v llvm/test/MC/AArch64/aarch64-build-attributes-asm-*
+${bindl}/llvm-lit -v llvm/test/MC/AArch64/aarch64-build-attributes-asm-*
+
+${binrl}/llvm-lit -v llvm/test/CodeGen/AArch64/aarch64-build-attributes-*
+${binral}/llvm-lit -v llvm/test/CodeGen/AArch64/aarch64-build-attributes-*
+${bindl}/llvm-lit -v llvm/test/CodeGen/AArch64/aarch64-build-attributes-*
+
+${binrl}/llvm-lit -v /home/sivsha01/Repos/llvm-project/llvm/test/tools/llvm-readobj/ELF/AArch64/aarch64-build-attributes-*
+${binral}/llvm-lit -v /home/sivsha01/Repos/llvm-project/llvm/test/tools/llvm-readobj/ELF/AArch64/aarch64-build-attributes-*
+${bindl}/llvm-lit -v /home/sivsha01/Repos/llvm-project/llvm/test/tools/llvm-readobj/ELF/AArch64/aarch64-build-attributes-*
|
982b60a to
e49d7e9
Compare
e49d7e9 to
37d4e35
Compare
|
Would you mind splitting this into multiple patches to make it easier to review? Based on the PR description, this looks like it could be three patches:
I think these are closely related enough to stay in one PR, but splitting them into patches allows me (and other reviewers) to see which test changes correspond to which code changes. |
37d4e35 to
292c34d
Compare
|
Since it is a relatively small patch, I will try to describe what has changed and what belongs where. Tag_PAuth_Platform and Tag_PAuth_Schema also removing Do not allow unknown tags to be strings Remove assertion when value exists removed. This is not an error and now release and debug behave the same. produce same object as before. general testing (and other) improvement Print and parse known string tags as a number + comment |
292c34d to
a74663f
Compare
|
You now have 5 different changes in one patch, please split it up. |
a74663f to
e2f6f2c
Compare
…les) This commit deletes previous tests files, following commits adding new test files.
Parsing error message should not print the symbol triggering error. (Only point to it with the symbol '^')
Print Tags as numbers followed by comments instead of using string representations. For example: .aeabi_attribute 0, 1 @ Tag_Feature_BTI instead of: .aeabi_attribute Tag_Feature_BTI, 1 This reduces dependencies between compiler and assembler versions.
- Reject strings for unknown tags. - Allow any value for Tag_PAuth_Platform and Tag_PAuth_Schema.
Adding the same value twice is valid, so the assertion has been removed.
Add test files
e2f6f2c to
e453ae0
Compare
|
Break down the change to several patches |
ostannard
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When splitting patches up, please make sure that the tests are updated in the same patch which makes the functional change. This makes it much easier for the reviewer to see what has/hasn't been tested, and the tests are also useful to the reviewer as an example of what behaviour is changed/added by the patch. In the current version of this PR, you've deleted most of the tests in the first commit and re-added them in the last one, which makes it harder to see what has been added/changed in them.
When a new value is provided for an existing tag, override.
AArch64 assembly comments should be '//' Lexer remove comments, no need to handle them when parsing.
Since the function accepts assembly that adds a different value for an existing tag, the 'Override' parameter is no longer needed.
78070f9 to
a6a4833
Compare
- Remove redundant comments - Remove default case from a fully covered switch
a6a4833 to
badefe8
Compare
llvm/test/MC/AArch64/aarch64-build-attributes-asm-aeabi-aeabi-known.s
Outdated
Show resolved
Hide resolved
llvm/test/MC/AArch64/aarch64-build-attributes-asm-aeabi-mixed.s
Outdated
Show resolved
Hide resolved
301057b to
71a6345
Compare
71a6345 to
6fdc1ee
Compare
|
✅ With the latest revision this PR passed the C/C++ code formatter. |
ce8434c to
ae37558
Compare
ostannard
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Uh oh!
There was an error while loading. Please reload this page.