diff options
author | Nick Lewycky <nicholas@mxc.ca> | 2012-07-24 07:21:08 +0000 |
---|---|---|
committer | Nick Lewycky <nicholas@mxc.ca> | 2012-07-24 07:21:08 +0000 |
commit | 8899d5c6fb3cf118c5c73eade290b6ebb2b3b850 (patch) | |
tree | 18fe26d262870291e657e2c1699ca5eb916c033b /test/Transforms/GlobalOpt | |
parent | ea0ca846478b8296f679afa419f2ad4e28073ad5 (diff) | |
download | external_llvm-8899d5c6fb3cf118c5c73eade290b6ebb2b3b850.zip external_llvm-8899d5c6fb3cf118c5c73eade290b6ebb2b3b850.tar.gz external_llvm-8899d5c6fb3cf118c5c73eade290b6ebb2b3b850.tar.bz2 |
Teach globalopt to not nuke all stores to globals. Keep them around of they
might be deliberate "one time" leaks, so that leak checkers can find them.
This is a reapply of r160602 with the fix that this time I'm committing the
code I thought I was committing last time; the I->eraseFromParent() goes
*after* the break out of the loop.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160664 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/GlobalOpt')
-rw-r--r-- | test/Transforms/GlobalOpt/2009-11-16-BrokenPerformHeapAllocSRoA.ll | 2 | ||||
-rw-r--r-- | test/Transforms/GlobalOpt/cleanup-pointer-root-users.ll | 19 |
2 files changed, 20 insertions, 1 deletions
diff --git a/test/Transforms/GlobalOpt/2009-11-16-BrokenPerformHeapAllocSRoA.ll b/test/Transforms/GlobalOpt/2009-11-16-BrokenPerformHeapAllocSRoA.ll index 54e8f90..40862bd 100644 --- a/test/Transforms/GlobalOpt/2009-11-16-BrokenPerformHeapAllocSRoA.ll +++ b/test/Transforms/GlobalOpt/2009-11-16-BrokenPerformHeapAllocSRoA.ll @@ -17,7 +17,7 @@ define void @test() nounwind ssp { %2 = sext i32 %1 to i64 ; <i64> [#uses=1] %3 = mul i64 %2, ptrtoint (%struct.strchartype* getelementptr (%struct.strchartype* null, i64 1) to i64) ; <i64> [#uses=1] %4 = tail call i8* @malloc(i64 %3) ; <i8*> [#uses=1] -; CHECK: call i8* @malloc(i64 +; CHECK-NOT: call i8* @malloc(i64 %5 = bitcast i8* %4 to %struct.strchartype* ; <%struct.strchartype*> [#uses=1] store %struct.strchartype* %5, %struct.strchartype** @chartypes, align 8 ret void diff --git a/test/Transforms/GlobalOpt/cleanup-pointer-root-users.ll b/test/Transforms/GlobalOpt/cleanup-pointer-root-users.ll new file mode 100644 index 0000000..f426120 --- /dev/null +++ b/test/Transforms/GlobalOpt/cleanup-pointer-root-users.ll @@ -0,0 +1,19 @@ +; RUN: opt -globalopt -S -o - < %s | FileCheck %s + +@test1 = internal global i8* null + +define void @test1a() { +; CHECK: @test1a +; CHECK-NOT: store +; CHECK-NEXT: ret void + store i8* null, i8** @test1 + ret void +} + +define void @test1b(i8* %p) { +; CHECK: @test1b +; CHECK-NEXT: store +; CHECK-NEXT: ret void + store i8* %p, i8** @test1 + ret void +} |