-
Notifications
You must be signed in to change notification settings - Fork 12.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
emit padding as undef values, take 2
merge also a few tests I had here for this feature, and FileCheck'ize one file llvm-svn: 101535
- Loading branch information
1 parent
4d273f4
commit 5863c99
Showing
5 changed files
with
47 additions
and
20 deletions.
There are no files selected for viewing
This file contains 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 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 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 |
|---|---|---|
| @@ -1,22 +1,34 @@ | ||
| // RUN: %clang_cc1 -triple i386-unknown-unknown %s -emit-llvm -o %t | ||
| // RUN: grep "{ i8\* null, i32 1024 }" %t | ||
| // RUN: grep "i32 0, i32 22" %t | ||
| // RUN: %clang_cc1 -triple i386-unknown-unknown %s -emit-llvm -o - | FileCheck %s | ||
|
|
||
| struct foo { | ||
| void *a; | ||
| int b; | ||
| }; | ||
|
|
||
| // CHECK: @u = global %union.anon zeroinitializer | ||
| union { int i; float f; } u = { }; | ||
|
|
||
| int main(int argc, char **argv) | ||
| { | ||
| union { int i; float f; } u2 = { }; | ||
| static struct foo foo = { | ||
| .b = 1024, | ||
| }; | ||
| } | ||
| // CHECK: @u2 = global %0 { i32 0, [4 x i8] undef } | ||
| union { int i; double f; } u2 = { }; | ||
|
|
||
| // CHECK: @b = global [2 x i32] [i32 0, i32 22] | ||
| int b[2] = { | ||
| [1] 22 | ||
| [1] = 22 | ||
| }; | ||
|
|
||
| int main(int argc, char **argv) | ||
| { | ||
| // CHECK: internal global %struct.foo { i8* null, i32 1024 } | ||
| static struct foo foo = { | ||
| .b = 1024, | ||
| }; | ||
|
|
||
| // CHECK: bitcast %union.anon* %u2 | ||
| // CHECK: call void @llvm.memset | ||
| union { int i; float f; } u2 = { }; | ||
|
|
||
| // CHECK-NOT: call void @llvm.memset | ||
| union { int i; float f; } u3; | ||
|
|
||
| // CHECK: ret i32 | ||
| } |
This file contains 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 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 |
|---|---|---|
| @@ -1,7 +1,13 @@ | ||
| // RUN: %clang_cc1 -emit-llvm %s -o - -triple i686-pc-linux-gnu | FileCheck %s | ||
|
|
||
| // Make sure we generate something sane instead of a ptrtoint | ||
| // CHECK: bitcast (%0* @r to %union.x*), [4 x i8] undef | ||
| union x {long long b;union x* a;} r = {.a = &r}; | ||
|
|
||
|
|
||
| // CHECK: bitcast (%0* @r to %union.x*), [4 x i8] zero | ||
| // CHECK: global %1 { [3 x i8] zeroinitializer, [5 x i8] undef } | ||
| union z { | ||
| char a[3]; | ||
| long long b; | ||
| }; | ||
| union z y = {}; |