Instruction *Inst = BI++;
if (isInstructionTriviallyDead(Inst))
Inst->eraseFromParent();
- else if (Constant *C = ConstantFoldInstruction(Inst, BI->getContext())) {
+ else if (Constant *C = ConstantFoldInstruction(Inst,
+ Inst->getContext())) {
Inst->replaceAllUsesWith(C);
Inst->eraseFromParent();
}
--- /dev/null
+; RUN: llvm-as < %s | opt -tailduplicate -disable-output
+; PR4662
+
+define void @a() {
+BB:
+ br label %BB6
+
+BB6:
+ %tmp9 = phi i64 [ 0, %BB ], [ 5, %BB34 ]
+ br label %BB34
+
+BB34:
+ br label %BB6
+}