[CloneFunction] Add a testcase for r277691/r277693
authorDavid Majnemer <david.majnemer@gmail.com>
Thu, 4 Aug 2016 21:28:59 +0000 (21:28 +0000)
committerDavid Majnemer <david.majnemer@gmail.com>
Thu, 4 Aug 2016 21:28:59 +0000 (21:28 +0000)
PR28848 had a very nice reduction of the underlying cause of the bug.
Our ValueMap had, in an entry for an Instruction, a ConstantInt.

This is not at all unexpected but should be handled properly.

llvm-svn: 277773

llvm/test/Transforms/Inline/inline_constprop.ll

index 813a71c..ab9e90c 100644 (file)
@@ -301,3 +301,24 @@ entry:
 ; CHECK-LABEL: define i32 @PR28802(
 ; CHECK: call i32 @PR28802.external(i32 0)
 ; CHECK: ret i32 0
+
+define internal i32 @PR28848.callee(i32 %p2, i1 %c) {
+entry:
+  br i1 %c, label %cond.end, label %cond.true
+
+cond.true:
+  br label %cond.end
+
+cond.end:
+  %cond = phi i32 [ 0, %cond.true ], [ %p2, %entry ]
+  %or = or i32 %cond, %p2
+  ret i32 %or
+}
+
+define i32 @PR28848() {
+entry:
+  %call = call i32 @PR28848.callee(i32 0, i1 false)
+  ret i32 %call
+}
+; CHECK-LABEL: define i32 @PR28848(
+; CHECK: ret i32 0