diff options
author | Bob Wilson <bob.wilson@apple.com> | 2012-09-03 05:15:15 +0000 |
---|---|---|
committer | Bob Wilson <bob.wilson@apple.com> | 2012-09-03 05:15:15 +0000 |
commit | 84451a110da981adfff2792c3aee5df322864da6 (patch) | |
tree | 2a002e044348ce3d34af1322734da220874a74da /test/Transforms/DeadStoreElimination | |
parent | c4d2560a2010456f4eea0007eb71829d5668e7dd (diff) | |
download | external_llvm-84451a110da981adfff2792c3aee5df322864da6.zip external_llvm-84451a110da981adfff2792c3aee5df322864da6.tar.gz external_llvm-84451a110da981adfff2792c3aee5df322864da6.tar.bz2 |
Fix more fallout from r158919, similar to PR13547.
This code used to only handle malloc-like calls, which do not read memory.
r158919 changed it to check isNoAliasFn(), which includes strdup-like and
realloc-like calls, but it was not checking for dependencies on the memory
read by those calls.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@163106 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/DeadStoreElimination')
-rw-r--r-- | test/Transforms/DeadStoreElimination/simple.ll | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test/Transforms/DeadStoreElimination/simple.ll b/test/Transforms/DeadStoreElimination/simple.ll index 7a8cdd5..e0eb90a 100644 --- a/test/Transforms/DeadStoreElimination/simple.ll +++ b/test/Transforms/DeadStoreElimination/simple.ll @@ -310,3 +310,17 @@ define void @test24([2 x i32]* %a, i32 %b, i32 %c) nounwind { store i32 %c, i32* %4, align 4 ret void } + +; Check another case like PR13547 where strdup is not like malloc. +; CHECK: @test25 +; CHECK: load i8 +; CHECK: store i8 0 +; CHECK: store i8 %tmp +define i8* @test25(i8* %p) nounwind { + %p.4 = getelementptr i8* %p, i64 4 + %tmp = load i8* %p.4, align 1 + store i8 0, i8* %p.4, align 1 + %q = call i8* @strdup(i8* %p) nounwind optsize + store i8 %tmp, i8* %p.4, align 1 + ret i8* %q +} |