-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[clang] Add support for new loop attribute [[clang::code_align()]] #70762
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
Merged
Merged
Changes from all commits
Commits
Show all changes
43 commits
Select commit
Hold shift + click to select a range
93d46d4
[clang] Add support for new loop attribute [[clang::code_align()]]
smanna12 d049dc9
Address review comments
smanna12 6c44cc1
Fix clang format errors
smanna12 f35c4be
Fix Lit test failure
smanna12 4c40ce2
Address review comments
smanna12 9144e44
Fix clang format errors
smanna12 22f66bd
Address review comments
smanna12 66f6269
Fix lit test failure
smanna12 3ac064b
Fix DuplicateCodeAlignAttrs check
smanna12 172e238
Fix Clang format errors
smanna12 c8d5270
Remove wrong function
smanna12 d16a0f9
Merge remote-tracking branch 'my_remote/main' into AddCodeAlignAttr
smanna12 b4b3c10
Merge remote-tracking branch 'my_remote/main' into AddCodeAlignAttr
smanna12 2e6ee33
Update diagnostic message and test
smanna12 82c2e70
Merge remote-tracking branch 'my_remote/main' into AddCodeAlignAttr
smanna12 8474860
Update min and max aligment check
smanna12 aa85ed1
Add additional members as static-constexpr
smanna12 0887674
Address review comments
smanna12 48e00f1
Fix test
smanna12 8fb7d22
Fix lit test failures
smanna12 8bec3c4
Fix bug for alignment value with ((__int128_t)0x1234567890abcde0ULL <…
smanna12 5c4ce9e
Fix clang format errors
smanna12 974ebf2
update patch
smanna12 06eadd9
Fix return nullptr check
smanna12 5ebb42f
Update patch with trySExtValue() and add test case for big negative
smanna12 ebcefed
Check an expression resulting in a negative that takes more than 64 bits
smanna12 72a1a69
Fix lit test
smanna12 845b687
Fix assertion and remove duplicate codes
smanna12 fca4436
Fix Clang format errors
smanna12 a8b13eb
Use Simple algorithm to handle duplicate attribute values.
smanna12 488b810
Fix clang format errors
smanna12 09b00c7
Fix Duplicate Attribute Values diagnostic using find_if()
smanna12 5fadd6a
Apply review comments
smanna12 87bb3f2
Fix clang format errors
smanna12 8ad4686
Diagnose non-identical duplicates as a 'conflicting' loop attr and
smanna12 e8ce33e
Merge remote-tracking branch 'my_remote/main' into AddCodeAlignAttr
smanna12 ac63c62
Address review comments
smanna12 8fd7bc1
Fix clang format errors
smanna12 6a986a1
Fix crash and add dependence tests
smanna12 f32df3f
Address review comments
smanna12 d5ee5c1
Fix clang format errors
smanna12 6778154
Fix diagnostic issues with conflicting attributes for template cases
smanna12 886c03a
Fix clang format errors
smanna12 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-llvm -x c %s %s -o - | FileCheck -check-prefix=CHECK-C %s | ||
// RUN: %clang_cc1 -fsyntax-only -emit-llvm -x c++ -std=c++11 %s -o - | FileCheck %s --check-prefixes CHECK-C,CHECK-CPP | ||
|
||
// CHECK-C: br label %for.cond, !llvm.loop ![[MD_FP:[0-9]+]] | ||
// CHECK-C: br label %while.cond, !llvm.loop ![[MD_FP_1:[0-9]+]] | ||
// CHECK-C: br i1 %cmp3, label %do.body, label %do.end, !llvm.loop ![[MD_FP_2:[0-9]+]] | ||
// CHECK-C: br label %for.cond5, !llvm.loop ![[MD_FP_3:[0-9]+]] | ||
|
||
// CHECK-CPP: br label %for.cond, !llvm.loop ![[MD_FP_4:[0-9]+]] | ||
// CHECK-CPP: br label %for.cond2, !llvm.loop ![[MD_FP_5:[0-9]+]] | ||
|
||
void bar(int); | ||
void code_align() { | ||
int a[10]; | ||
// CHECK-C: ![[MD_FP]] = distinct !{![[MD_FP]], ![[MP:[0-9]+]], ![[MD_code_align:[0-9]+]]} | ||
// CHECK-C-NEXT: ![[MP]] = !{!"llvm.loop.mustprogress"} | ||
// CHECK-C-NEXT: ![[MD_code_align]] = !{!"llvm.loop.align", i32 4} | ||
[[clang::code_align(4)]] | ||
for(int I=0; I<128; ++I) { bar(I); } | ||
|
||
// CHECK-C: ![[MD_FP_1]] = distinct !{![[MD_FP_1]], ![[MP]], ![[MD_code_align_1:[0-9]+]]} | ||
// CHECK-C-NEXT: ![[MD_code_align_1]] = !{!"llvm.loop.align", i32 16} | ||
int i = 0; | ||
[[clang::code_align(16)]] while (i < 60) { | ||
a[i] += 3; | ||
} | ||
|
||
// CHECK-C: ![[MD_FP_2]] = distinct !{![[MD_FP_2]], ![[MP]], ![[MD_code_align_2:[0-9]+]]} | ||
// CHECK-C-NEXT: ![[MD_code_align_2]] = !{!"llvm.loop.align", i32 8} | ||
int b = 10; | ||
[[clang::code_align(8)]] do { | ||
b = b + 1; | ||
} while (b < 20); | ||
|
||
// CHECK-C: ![[MD_FP_3]] = distinct !{![[MD_FP_3]], ![[MP]], ![[MD_code_align_3:[0-9]+]]} | ||
// CHECK-C-NEXT: ![[MD_code_align_3]] = !{!"llvm.loop.align", i32 64} | ||
[[clang::code_align(64)]] | ||
for(int I=0; I<128; ++I) { bar(I); } | ||
} | ||
|
||
#if __cplusplus >= 201103L | ||
template <int A, int B> | ||
void code_align_cpp() { | ||
int a[10]; | ||
// CHECK-CPP: ![[MD_FP_4]] = distinct !{![[MD_FP_4]], ![[MP]], ![[MD_code_align_4:[0-9]+]]} | ||
// CHECK-CPP-NEXT: ![[MD_code_align_4]] = !{!"llvm.loop.align", i32 32} | ||
[[clang::code_align(A)]] for (int i = 0; i != 10; ++i) | ||
a[i] = 0; | ||
|
||
// CHECK-CPP: ![[MD_FP_5]] = distinct !{![[MD_FP_5]], ![[MD_code_align]]} | ||
int c[] = {0, 1, 2, 3, 4, 5}; | ||
[[clang::code_align(B)]] for (int n : c) { n *= 2; } | ||
} | ||
|
||
int main() { | ||
code_align_cpp<32, 4>(); | ||
return 0; | ||
} | ||
#endif |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.