diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2013-09-24 17:34:29 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2013-09-24 17:34:29 +0000 |
commit | d44f9f2ff88cd03e3f944ecdd6373737d5acdb90 (patch) | |
tree | 670adc8506299dfd0ef486b906c0cc9a6b6b4a72 /test/Transforms | |
parent | 085e23841e9c4f4682385fce456704a5f75f9cdc (diff) | |
download | external_llvm-d44f9f2ff88cd03e3f944ecdd6373737d5acdb90.zip external_llvm-d44f9f2ff88cd03e3f944ecdd6373737d5acdb90.tar.gz external_llvm-d44f9f2ff88cd03e3f944ecdd6373737d5acdb90.tar.bz2 |
MemoryBuiltins: Reinstate optimizing (uninitialized) loads from operator new.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191315 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms')
-rw-r--r-- | test/Transforms/GVN/malloc-load-removal.ll | 31 |
1 files changed, 28 insertions, 3 deletions
diff --git a/test/Transforms/GVN/malloc-load-removal.ll b/test/Transforms/GVN/malloc-load-removal.ll index e93a62a..d2d2fd7 100644 --- a/test/Transforms/GVN/malloc-load-removal.ll +++ b/test/Transforms/GVN/malloc-load-removal.ll @@ -7,7 +7,7 @@ target triple = "x86_64-apple-macosx10.8.0" declare i8* @malloc(i64) nounwind -define noalias i8* @test() nounwind uwtable ssp { +define noalias i8* @test1() nounwind uwtable ssp { entry: %call = tail call i8* @malloc(i64 100) nounwind %0 = load i8* %call, align 1 @@ -21,11 +21,36 @@ if.then: ; preds = %entry if.end: ; preds = %if.then, %entry ret i8* %call -; CHECK-LABEL: @test( +; CHECK-LABEL: @test1( ; CHECK-NOT: load ; CHECK-NOT: icmp -; CHECK_NO_LIBCALLS-LABEL: @test( +; CHECK_NO_LIBCALLS-LABEL: @test1( +; CHECK_NO_LIBCALLS: load +; CHECK_NO_LIBCALLS: icmp +} + +declare i8* @_Znwm(i64) nounwind + +define noalias i8* @test2() nounwind uwtable ssp { +entry: + %call = tail call i8* @_Znwm(i64 100) nounwind + %0 = load i8* %call, align 1 + %tobool = icmp eq i8 %0, 0 + br i1 %tobool, label %if.end, label %if.then + +if.then: ; preds = %entry + store i8 0, i8* %call, align 1 + br label %if.end + +if.end: ; preds = %if.then, %entry + ret i8* %call + +; CHECK-LABEL: @test2( +; CHECK-NOT: load +; CHECK-NOT: icmp + +; CHECK_NO_LIBCALLS-LABEL: @test2( ; CHECK_NO_LIBCALLS: load ; CHECK_NO_LIBCALLS: icmp } |