aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorNick Lewycky <nicholas@mxc.ca>2011-08-03 00:43:35 +0000
committerNick Lewycky <nicholas@mxc.ca>2011-08-03 00:43:35 +0000
commitd5061a9268d04c80af764291ef93fe3f7b51f0de (patch)
treed63baa440ac792dfe074875195844787e53420db /test
parent19308a1ea1c34e3dbed7b801408b2a8fcaba73f5 (diff)
downloadexternal_llvm-d5061a9268d04c80af764291ef93fe3f7b51f0de.zip
external_llvm-d5061a9268d04c80af764291ef93fe3f7b51f0de.tar.gz
external_llvm-d5061a9268d04c80af764291ef93fe3f7b51f0de.tar.bz2
Fix logical error when detecting lifetime intrinsics.
Don't replace a gep/bitcast with 'undef' because that will form a "free(undef)" which in turn means "unreachable". What we wanted was a no-op. Instead, analyze the whole tree and look for all the instructions we need to delete first, then delete them second, not relying on the use_list to stay consistent. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136752 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r--test/Transforms/InstCombine/malloc-free-delete.ll11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/Transforms/InstCombine/malloc-free-delete.ll b/test/Transforms/InstCombine/malloc-free-delete.ll
index a35e7b6..eae973d 100644
--- a/test/Transforms/InstCombine/malloc-free-delete.ll
+++ b/test/Transforms/InstCombine/malloc-free-delete.ll
@@ -35,3 +35,14 @@ define void @test3() {
call void @llvm.lifetime.end(i64 10, i8* %a)
ret void
}
+
+;; This used to crash.
+define void @test4() {
+; CHECK: @test4
+; CHECK-NEXT: ret void
+ %A = call i8* @malloc(i32 16000)
+ %B = bitcast i8* %A to double*
+ %C = bitcast double* %B to i8*
+ call void @free(i8* %C)
+ ret void
+}