-
Notifications
You must be signed in to change notification settings - Fork 13.6k
[KeyIntsr][Clang] Builtins alloca auto-init atom #134651
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
5 commits
Select commit
Hold shift + click to select a range
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
|
||
// RUN: %clang_cc1 -gkey-instructions -x c++ %s -debug-info-kind=line-tables-only -gno-column-info -emit-llvm -o - -ftrivial-auto-var-init=zero -fenable-matrix -disable-llvm-passes \ | ||
// RUN: | FileCheck %s --implicit-check-not atomGroup --implicit-check-not atomRank | ||
|
||
// RUN: %clang_cc1 -gkey-instructions -x c %s -debug-info-kind=line-tables-only -gno-column-info -emit-llvm -o - -ftrivial-auto-var-init=zero -fenable-matrix -disable-llvm-passes \ | ||
// RUN: | FileCheck %s --implicit-check-not atomGroup --implicit-check-not atomRank | ||
|
||
typedef float m2x2 __attribute__((matrix_type(2, 2))); | ||
m2x2 mat; | ||
float f4[4]; | ||
float f8[8]; | ||
int v = 3; | ||
|
||
void fun() { | ||
// CHECK: %a = alloca ptr, align 8 | ||
// CHECK: %0 = alloca i8, i64 4{{.*}}, !dbg [[G1R2:!.*]] | ||
// CHECK: call void @llvm.memset{{.*}}, !dbg [[G1R1:!.*]], !annotation | ||
// CHECK: store ptr %0, ptr %a{{.*}}, !dbg [[G1R1:!.*]] | ||
void *a = __builtin_alloca(4); | ||
|
||
// CHECK: %1 = alloca i8, i64 4{{.*}}, !dbg [[G2R2:!.*]] | ||
// CHECK: call void @llvm.memset{{.*}}, !dbg [[G2R1:!.*]], !annotation | ||
// CHECK: store ptr %1, ptr %b{{.*}}, !dbg [[G2R1:!.*]] | ||
void *b = __builtin_alloca_with_align(4, 8); | ||
|
||
// CHECK: %2 = load <4 x float>, ptr @mat{{.*}}, !dbg [[G3R2:!.*]] | ||
// CHECK: call void @llvm.matrix.column.major.store.v4f32{{.*}}, !dbg [[G3R1:!.*]] | ||
__builtin_matrix_column_major_store(mat, f4, sizeof(float) * 2); | ||
|
||
// CHECK: call void @llvm.memset{{.*}}, !dbg [[G4R1:!.*]] | ||
__builtin_bzero(f4, sizeof(float) * 2); | ||
|
||
// CHECK: call void @llvm.memmove{{.*}}, !dbg [[G5R1:!.*]] | ||
__builtin_bcopy(f4, f8, sizeof(float) * 4); | ||
|
||
// CHECK: call void @llvm.memcpy{{.*}}, !dbg [[G6R1:!.*]] | ||
__builtin_memcpy(f4, f8, sizeof(float) * 4); | ||
|
||
// CHECK: call void @llvm.memcpy{{.*}}, !dbg [[G7R1:!.*]] | ||
__builtin_mempcpy(f4, f8, sizeof(float) * 4); | ||
|
||
// CHECK: call void @llvm.memcpy{{.*}}, !dbg [[G8R1:!.*]] | ||
__builtin_memcpy_inline(f4, f8, sizeof(float) * 4); | ||
|
||
// CHECK: call void @llvm.memcpy{{.*}}, !dbg [[G9R1:!.*]] | ||
__builtin___memcpy_chk(f4, f8, sizeof(float) * 4, -1); | ||
|
||
// CHECK: call void @llvm.memmove{{.*}}, !dbg [[G10R1:!.*]] | ||
__builtin___memmove_chk(f4, f8, sizeof(float) * 4, -1); | ||
|
||
// CHECK: call void @llvm.memmove{{.*}}, !dbg [[G11R1:!.*]] | ||
__builtin_memmove(f4, f8, sizeof(float) * 4); | ||
|
||
// CHECK: call void @llvm.memset{{.*}}, !dbg [[G12R1:!.*]] | ||
__builtin_memset(f4, 0, sizeof(float) * 4); | ||
|
||
// CHECK: call void @llvm.memset{{.*}}, !dbg [[G13R1:!.*]] | ||
__builtin_memset_inline(f4, 0, sizeof(float) * 4); | ||
|
||
// CHECK: call void @llvm.memset{{.*}}, !dbg [[G14R1:!.*]] | ||
__builtin___memset_chk(f4, 0, sizeof(float), -1); | ||
|
||
// CHECK: %3 = load i32, ptr @v{{.*}}, !dbg [[G15R3:!.*]] | ||
// CHECK-NEXT: %4 = trunc i32 %3 to i8, !dbg [[G15R2:!.*]] | ||
// CHECK-NEXT: call void @llvm.memset{{.*}}, !dbg [[G15R1:!.*]] | ||
__builtin_memset(f4, v, sizeof(float) * 4); | ||
} | ||
|
||
// CHECK: [[G1R2]] = !DILocation({{.*}}, atomGroup: 1, atomRank: 2) | ||
// CHECK: [[G1R1]] = !DILocation({{.*}}, atomGroup: 1, atomRank: 1) | ||
// CHECK: [[G2R2]] = !DILocation({{.*}}, atomGroup: 2, atomRank: 2) | ||
// CHECK: [[G2R1]] = !DILocation({{.*}}, atomGroup: 2, atomRank: 1) | ||
// CHECK: [[G3R2]] = !DILocation({{.*}}, atomGroup: 3, atomRank: 2) | ||
// CHECK: [[G3R1]] = !DILocation({{.*}}, atomGroup: 3, atomRank: 1) | ||
// CHECK: [[G4R1]] = !DILocation({{.*}}, atomGroup: 4, atomRank: 1) | ||
// CHECK: [[G5R1]] = !DILocation({{.*}}, atomGroup: 5, atomRank: 1) | ||
// CHECK: [[G6R1]] = !DILocation({{.*}}, atomGroup: 6, atomRank: 1) | ||
// CHECK: [[G7R1]] = !DILocation({{.*}}, atomGroup: 7, atomRank: 1) | ||
// CHECK: [[G8R1]] = !DILocation({{.*}}, atomGroup: 8, atomRank: 1) | ||
// CHECK: [[G9R1]] = !DILocation({{.*}}, atomGroup: 9, atomRank: 1) | ||
// CHECK: [[G10R1]] = !DILocation({{.*}}, atomGroup: 10, atomRank: 1) | ||
// CHECK: [[G11R1]] = !DILocation({{.*}}, atomGroup: 11, atomRank: 1) | ||
// CHECK: [[G12R1]] = !DILocation({{.*}}, atomGroup: 12, atomRank: 1) | ||
// CHECK: [[G13R1]] = !DILocation({{.*}}, atomGroup: 13, atomRank: 1) | ||
// CHECK: [[G14R1]] = !DILocation({{.*}}, atomGroup: 14, atomRank: 1) | ||
// CHECK: [[G15R3]] = !DILocation({{.*}}, atomGroup: 15, atomRank: 3) | ||
// CHECK: [[G15R2]] = !DILocation({{.*}}, atomGroup: 15, atomRank: 2) | ||
// CHECK: [[G15R1]] = !DILocation({{.*}}, atomGroup: 15, atomRank: 1) |
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.
One last question, for this (and possibly other memsets) is it possible that the src argument is an instruction, and if so should it be get a rank 2 location?
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.
Fair point - done. The other memsets covered so far look like they all store constants.