[llvm-commits] [llvm] r77716 - in /llvm/trunk: lib/Transforms/Scalar/TailDuplication.cpp test/Transforms/TailDup/2009-07-31-phicrash.ll

Eli Friedman eli.friedman at gmail.com
Fri Jul 31 12:36:47 PDT 2009


Author: efriedma
Date: Fri Jul 31 14:36:47 2009
New Revision: 77716

URL: http://llvm.org/viewvc/llvm-project?rev=77716&view=rev
Log:
PR4662: Fix a crash introduced by the recent LLVMContext changes.


Added:
    llvm/trunk/test/Transforms/TailDup/2009-07-31-phicrash.ll
Modified:
    llvm/trunk/lib/Transforms/Scalar/TailDuplication.cpp

Modified: llvm/trunk/lib/Transforms/Scalar/TailDuplication.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/TailDuplication.cpp?rev=77716&r1=77715&r2=77716&view=diff

==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/TailDuplication.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/TailDuplication.cpp Fri Jul 31 14:36:47 2009
@@ -360,7 +360,8 @@
       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();
       }

Added: llvm/trunk/test/Transforms/TailDup/2009-07-31-phicrash.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/TailDup/2009-07-31-phicrash.ll?rev=77716&view=auto

==============================================================================
--- llvm/trunk/test/Transforms/TailDup/2009-07-31-phicrash.ll (added)
+++ llvm/trunk/test/Transforms/TailDup/2009-07-31-phicrash.ll Fri Jul 31 14:36:47 2009
@@ -0,0 +1,14 @@
+; 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
+}





More information about the llvm-commits mailing list