summaryrefslogtreecommitdiffstats
path: root/test/CodeGenCXX/cxx0x-initializer-references.cpp
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2015-03-07 13:37:13 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2015-03-07 13:37:13 +0000
commit9e51c85a582963e272b3462d5f40752aff2830ab (patch)
treec4ac9f2e46c4c3359a2a3a2d45e0fd787fd0137b /test/CodeGenCXX/cxx0x-initializer-references.cpp
parent8cd8681110bbfc2f2009505304db5a3300adbf61 (diff)
Reapply r231508 "CodeGen: Emit constant temporaries into read-only globals."
I disabled putting the new global into the same COMDAT as the function for now. There's a fundamental problem when we inline references to the global but still have the global in a COMDAT linked to the inlined function. Since this is only an optimization there may be other versions of the COMDAT around that are missing the new global and hell breaks loose at link time. I hope the chromium build doesn't break this time :) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@231564 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGenCXX/cxx0x-initializer-references.cpp')
-rw-r--r--test/CodeGenCXX/cxx0x-initializer-references.cpp18
1 files changed, 13 insertions, 5 deletions
diff --git a/test/CodeGenCXX/cxx0x-initializer-references.cpp b/test/CodeGenCXX/cxx0x-initializer-references.cpp
index 23d244bc56..d4a8f20f35 100644
--- a/test/CodeGenCXX/cxx0x-initializer-references.cpp
+++ b/test/CodeGenCXX/cxx0x-initializer-references.cpp
@@ -35,22 +35,30 @@ namespace reference {
// CHECK-NEXT: ret
}
- void reference_to_aggregate() {
+ void reference_to_aggregate(int i) {
// CHECK: getelementptr {{.*}}, i32 0, i32 0
// CHECK-NEXT: store i32 1
// CHECK-NEXT: getelementptr {{.*}}, i32 0, i32 1
- // CHECK-NEXT: store i32 2
+ // CHECK-NEXT: %[[I1:.*]] = load i32, i32*
+ // CHECK-NEXT: store i32 %[[I1]]
// CHECK-NEXT: store %{{.*}}* %{{.*}}, %{{.*}}** %{{.*}}, align
- const A &ra1{1, 2};
+ const A &ra1{1, i};
// CHECK-NEXT: getelementptr inbounds [3 x i32], [3 x i32]* %{{.*}}, i{{32|64}} 0, i{{32|64}} 0
// CHECK-NEXT: store i32 1
// CHECK-NEXT: getelementptr inbounds i32, i32* %{{.*}}, i{{32|64}} 1
// CHECK-NEXT: store i32 2
// CHECK-NEXT: getelementptr inbounds i32, i32* %{{.*}}, i{{32|64}} 1
- // CHECK-NEXT: store i32 3
+ // CHECK-NEXT: %[[I2:.*]] = load i32, i32*
+ // CHECK-NEXT: store i32 %[[I2]]
// CHECK-NEXT: store [3 x i32]* %{{.*}}, [3 x i32]** %{{.*}}, align
- const int (&arrayRef)[] = {1, 2, 3};
+ const int (&arrayRef)[] = {1, 2, i};
+
+ // CHECK: store %{{.*}}* @{{.*}}, %{{.*}}** %{{.*}}, align
+ const A &constra1{1, 2};
+
+ // CHECK-NEXT: store [3 x i32]* @{{.*}}, [3 x i32]** %{{.*}}, align
+ const int (&constarrayRef)[] = {1, 2, 3};
// CHECK-NEXT: ret
}