forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 0
perf/inliner attrs #1
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
Open
goldsteinn
wants to merge
9
commits into
main
Choose a base branch
from
perf/inliner-attrs
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
4898b81
Add some additional tests for progagating attributes before inlining;…
goldsteinn aa509b4
Regen checks for old test; NFC
goldsteinn ea6e9c9
Split some tests for c/cpp; NFC
goldsteinn 13d90a4
Use "best" ret attribute when propagating attributes during inlining
goldsteinn 348e2f1
Also propagate `noundef` and `align` ret attributes during inlining
goldsteinn 4768a8a
Propagate callee function memory access attributes before inlining
goldsteinn e43e301
Propagate callee argument memory access attributes before inlining
goldsteinn 825df6c
Propagate some additional callee argument attributes before inlining
goldsteinn 4ccda94
Propagate some callee function attributes to callsites before inlining
goldsteinn 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| // RUN: %clang_cc1 -x c++ -std=c++11 -ffreestanding %s -triple=x86_64-unknown-unknown -emit-llvm -o - | FileCheck %s | ||
|
|
||
| // PR33722 | ||
| // RUN: %clang_cc1 -x c++ -ffreestanding %s -triple x86_64-unknown-unknown -fms-extensions -fms-compatibility-version=19.00 -emit-llvm -o - | FileCheck %s | ||
|
|
||
| #include <x86intrin.h> | ||
|
|
||
| int test_bit_scan_forward(int a) { | ||
| // CHECK-LABEL: test_bit_scan_forward | ||
| // CHECK: %[[call:.*]] = call noundef i32 @llvm.cttz.i32(i32 %{{.*}}, i1 true) | ||
| // CHECK: ret i32 %[[call]] | ||
| return _bit_scan_forward(a); | ||
| } | ||
|
|
||
| int test_bit_scan_reverse(int a) { | ||
| // CHECK-LABEL: test_bit_scan_reverse | ||
| // CHECK: %[[call:.*]] = call i32 @llvm.ctlz.i32(i32 %{{.*}}, i1 true) | ||
| // CHECK: %[[sub:.*]] = sub nsw i32 31, %[[call]] | ||
| // CHECK: ret i32 %[[sub]] | ||
| return _bit_scan_reverse(a); | ||
| } | ||
|
|
||
| int test__bsfd(int X) { | ||
| // CHECK-LABEL: test__bsfd | ||
| // CHECK: %[[call:.*]] = call noundef i32 @llvm.cttz.i32(i32 %{{.*}}, i1 true) | ||
| return __bsfd(X); | ||
| } | ||
|
|
||
| int test__bsfq(long long X) { | ||
| // CHECK-LABEL: test__bsfq | ||
| // CHECK: %[[call:.*]] = call i64 @llvm.cttz.i64(i64 %{{.*}}, i1 true) | ||
| return __bsfq(X); | ||
| } | ||
|
|
||
| int test__bsrd(int X) { | ||
| // CHECK-LABEL: test__bsrd | ||
| // CHECK: %[[call:.*]] = call i32 @llvm.ctlz.i32(i32 %{{.*}}, i1 true) | ||
| // CHECK: %[[sub:.*]] = sub nsw i32 31, %[[call]] | ||
| return __bsrd(X); | ||
| } | ||
|
|
||
| int test__bsrq(long long X) { | ||
| // CHECK-LABEL: test__bsrq | ||
| // CHECK: %[[call:.*]] = call i64 @llvm.ctlz.i64(i64 %{{.*}}, i1 true) | ||
| // CHECK: %[[cast:.*]] = trunc i64 %[[call]] to i32 | ||
| // CHECK: %[[sub:.*]] = sub nsw i32 63, %[[cast]] | ||
| return __bsrq(X); | ||
| } | ||
|
|
||
| // Test constexpr handling. | ||
| #if defined(__cplusplus) && (__cplusplus >= 201103L) | ||
|
|
||
| char bsf_0[_bit_scan_forward(0x00000001) == 0 ? 1 : -1]; | ||
| char bsf_1[_bit_scan_forward(0x10000000) == 28 ? 1 : -1]; | ||
|
|
||
| char bsr_0[_bit_scan_reverse(0x00000001) == 0 ? 1 : -1]; | ||
| char bsr_1[_bit_scan_reverse(0x01000000) == 24 ? 1 : -1]; | ||
|
|
||
| char bsfd_0[__bsfd(0x00000008) == 3 ? 1 : -1]; | ||
| char bsfd_1[__bsfd(0x00010008) == 3 ? 1 : -1]; | ||
|
|
||
| char bsrd_0[__bsrd(0x00000010) == 4 ? 1 : -1]; | ||
| char bsrd_1[__bsrd(0x00100100) == 20 ? 1 : -1]; | ||
|
|
||
| char bsfq_0[__bsfq(0x0000000800000000ULL) == 35 ? 1 : -1]; | ||
| char bsfq_1[__bsfq(0x0004000000000000ULL) == 50 ? 1 : -1]; | ||
|
|
||
| char bsrq_0[__bsrq(0x0000100800000000ULL) == 44 ? 1 : -1]; | ||
| char bsrq_1[__bsrq(0x0004000100000000ULL) == 50 ? 1 : -1]; | ||
|
|
||
| #endif |
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,67 @@ | ||
| // RUN: %clang_cc1 -x c++ -std=c++11 -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +popcnt -emit-llvm -o - | FileCheck %s --check-prefixes=CHECK,CHECK-POPCNT | ||
| // RUN: %clang_cc1 -x c++ -std=c++11 -ffreestanding %s -triple=x86_64-apple-darwin -emit-llvm -o - | FileCheck %s | ||
|
|
||
| #include <x86intrin.h> | ||
|
|
||
| #ifdef __POPCNT__ | ||
| int test_mm_popcnt_u32(unsigned int __X) { | ||
| //CHECK-POPCNT: call noundef i32 @llvm.ctpop.i32 | ||
| return _mm_popcnt_u32(__X); | ||
| } | ||
| #endif | ||
|
|
||
| int test_popcnt32(unsigned int __X) { | ||
| //CHECK: call noundef i32 @llvm.ctpop.i32 | ||
| return _popcnt32(__X); | ||
| } | ||
|
|
||
| int test__popcntd(unsigned int __X) { | ||
| //CHECK: call noundef i32 @llvm.ctpop.i32 | ||
| return __popcntd(__X); | ||
| } | ||
|
|
||
| #ifdef __x86_64__ | ||
| #ifdef __POPCNT__ | ||
| long long test_mm_popcnt_u64(unsigned long long __X) { | ||
| //CHECK-POPCNT: call i64 @llvm.ctpop.i64 | ||
| return _mm_popcnt_u64(__X); | ||
| } | ||
| #endif | ||
|
|
||
| long long test_popcnt64(unsigned long long __X) { | ||
| //CHECK: call i64 @llvm.ctpop.i64 | ||
| return _popcnt64(__X); | ||
| } | ||
|
|
||
| long long test__popcntq(unsigned long long __X) { | ||
| //CHECK: call i64 @llvm.ctpop.i64 | ||
| return __popcntq(__X); | ||
| } | ||
| #endif | ||
|
|
||
| // Test constexpr handling. | ||
| #if defined(__cplusplus) && (__cplusplus >= 201103L) | ||
| #if defined(__POPCNT__) | ||
| char ctpop32_0[_mm_popcnt_u32(0x00000000) == 0 ? 1 : -1]; | ||
| char ctpop32_1[_mm_popcnt_u32(0x000000F0) == 4 ? 1 : -1]; | ||
| #endif | ||
|
|
||
| char popcnt32_0[_popcnt32(0x00000000) == 0 ? 1 : -1]; | ||
| char popcnt32_1[_popcnt32(0x100000F0) == 5 ? 1 : -1]; | ||
|
|
||
| char popcntd_0[__popcntd(0x00000000) == 0 ? 1 : -1]; | ||
| char popcntd_1[__popcntd(0x00F000F0) == 8 ? 1 : -1]; | ||
|
|
||
| #ifdef __x86_64__ | ||
| #if defined(__POPCNT__) | ||
| char ctpop64_0[_mm_popcnt_u64(0x0000000000000000ULL) == 0 ? 1 : -1]; | ||
| char ctpop64_1[_mm_popcnt_u64(0xF000000000000001ULL) == 5 ? 1 : -1]; | ||
| #endif | ||
|
|
||
| char popcnt64_0[_popcnt64(0x0000000000000000ULL) == 0 ? 1 : -1]; | ||
| char popcnt64_1[_popcnt64(0xF00000F000000001ULL) == 9 ? 1 : -1]; | ||
|
|
||
| char popcntq_0[__popcntq(0x0000000000000000ULL) == 0 ? 1 : -1]; | ||
| char popcntq_1[__popcntq(0xF000010000300001ULL) == 8 ? 1 : -1]; | ||
| #endif | ||
| #endif |
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
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.
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.
Foo bar baz