diff options
Diffstat (limited to 'test/Transforms/GlobalOpt/invariant.ll')
-rw-r--r-- | test/Transforms/GlobalOpt/invariant.ll | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/test/Transforms/GlobalOpt/invariant.ll b/test/Transforms/GlobalOpt/invariant.ll new file mode 100644 index 0000000..2662d60 --- /dev/null +++ b/test/Transforms/GlobalOpt/invariant.ll @@ -0,0 +1,34 @@ +; RUN: opt -globalopt -S -o - < %s | FileCheck %s + +declare {}* @llvm.invariant.start(i64 %size, i8* nocapture %ptr) + +define void @test1(i8* %ptr) { + call {}* @llvm.invariant.start(i64 -1, i8* %ptr) + ret void +} + +@object1 = global i32 0 +; CHECK: @object1 = constant i32 -1 +define void @ctor1() { + store i32 -1, i32* @object1 + %A = bitcast i32* @object1 to i8* + call void @test1(i8* %A) + ret void +} + + +@object2 = global i32 0 +; CHECK: @object2 = global i32 0 +define void @ctor2() { + store i32 -1, i32* @object2 + %A = bitcast i32* @object2 to i8* + %B = call {}* @llvm.invariant.start(i64 -1, i8* %A) + ; Why in the world does this pass the verifier? + %C = bitcast {}* %B to i8* + ret void +} + +@llvm.global_ctors = appending constant + [2 x { i32, void ()* }] + [ { i32, void ()* } { i32 65535, void ()* @ctor1 }, + { i32, void ()* } { i32 65535, void ()* @ctor2 } ] |