aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2012-08-17 14:16:37 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2012-08-17 14:16:37 +0000
commit823573a38137191678bf1c7194048ab51d39f33c (patch)
tree472061a6fb24c4bf3255ff53fb6d2a77bb9cbd47 /test
parent4e81d40545b01e0ce486b4de72282e66b91f48e9 (diff)
downloadexternal_llvm-823573a38137191678bf1c7194048ab51d39f33c.zip
external_llvm-823573a38137191678bf1c7194048ab51d39f33c.tar.gz
external_llvm-823573a38137191678bf1c7194048ab51d39f33c.tar.bz2
Guard MemoryBuiltins against self-looping GEPs, which can occur in unreachable code due to constant propagation.
Fixes PR13621. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162098 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r--test/Transforms/InstCombine/objsize.ll17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/Transforms/InstCombine/objsize.ll b/test/Transforms/InstCombine/objsize.ll
index dbb0ffc..d7e2921 100644
--- a/test/Transforms/InstCombine/objsize.ll
+++ b/test/Transforms/InstCombine/objsize.ll
@@ -238,3 +238,20 @@ xpto:
return:
ret i32 42
}
+
+; CHECK: @PR13621
+define i32 @PR13621(i1 %bool) nounwind {
+entry:
+ %cond = or i1 %bool, true
+ br i1 %cond, label %return, label %xpto
+
+; technically reachable, but this malformed IR may appear as a result of constant propagation
+xpto:
+ %gep = getelementptr i8* %gep, i32 1
+ %o = call i32 @llvm.objectsize.i32(i8* %gep, i1 true)
+; CHECK: ret i32 undef
+ ret i32 %o
+
+return:
+ ret i32 7
+}