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 | faa9c3b035f5285e91ddd88e73aad9c8fe3d6bf9 (patch) | |
tree | 43f37950229f41e9e9ccad4403eea2e0dd86938d /llvm/test/Transforms/GlobalOpt/cleanup-pointer-root-users.ll | |
parent | 1c7207c88682cf49abf8947a952fab5497b24dbb (diff) | |
download | llvm-faa9c3b035f5285e91ddd88e73aad9c8fe3d6bf9.zip llvm-faa9c3b035f5285e91ddd88e73aad9c8fe3d6bf9.tar.gz llvm-faa9c3b035f5285e91ddd88e73aad9c8fe3d6bf9.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.
llvm-svn: 160664
Diffstat (limited to 'llvm/test/Transforms/GlobalOpt/cleanup-pointer-root-users.ll')
-rw-r--r-- | llvm/test/Transforms/GlobalOpt/cleanup-pointer-root-users.ll | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/llvm/test/Transforms/GlobalOpt/cleanup-pointer-root-users.ll b/llvm/test/Transforms/GlobalOpt/cleanup-pointer-root-users.ll new file mode 100644 index 0000000..f426120 --- /dev/null +++ b/llvm/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 +} |