[llvm-commits] [llvm] r132194 - in /llvm/trunk: lib/Target/ARM/ARMFastISel.cpp lib/Transforms/Scalar/LICM.cpp test/CodeGen/ARM/fast-isel-crash2.ll

Eli Friedman eli.friedman at gmail.com
Fri May 27 11:02:04 PDT 2011


Author: efriedma
Date: Fri May 27 13:02:04 2011
New Revision: 132194

URL: http://llvm.org/viewvc/llvm-project?rev=132194&view=rev
Log:
Fix a silly mistake (which trips over an assertion) in r132099.  rdar://9515076


Added:
    llvm/trunk/test/CodeGen/ARM/fast-isel-crash2.ll
Modified:
    llvm/trunk/lib/Target/ARM/ARMFastISel.cpp
    llvm/trunk/lib/Transforms/Scalar/LICM.cpp

Modified: llvm/trunk/lib/Target/ARM/ARMFastISel.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMFastISel.cpp?rev=132194&r1=132193&r2=132194&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMFastISel.cpp (original)
+++ llvm/trunk/lib/Target/ARM/ARMFastISel.cpp Fri May 27 13:02:04 2011
@@ -1981,6 +1981,8 @@
   unsigned Opc;
   bool isZext = isa<ZExtInst>(I);
   bool isBoolZext = false;
+  if (!SrcVT.isSimple())
+    return false;
   switch (SrcVT.getSimpleVT().SimpleTy) {
   default: return false;
   case MVT::i16:

Modified: llvm/trunk/lib/Transforms/Scalar/LICM.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LICM.cpp?rev=132194&r1=132193&r2=132194&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/LICM.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LICM.cpp Fri May 27 13:02:04 2011
@@ -372,7 +372,11 @@
     return !pointerInvalidatedByLoop(LI->getOperand(0), Size,
                                      LI->getMetadata(LLVMContext::MD_tbaa));
   } else if (CallInst *CI = dyn_cast<CallInst>(&I)) {
-    // Handle obvious cases efficiently.
+    // Don't sink or hoist dbg info; it's legal, but not useful.
+    if (isa<DbgInfoIntrinsic>(I))
+      return false;
+
+    // Handle simple cases by querying alias analysis.
     AliasAnalysis::ModRefBehavior Behavior = AA->getModRefBehavior(CI);
     if (Behavior == AliasAnalysis::DoesNotAccessMemory)
       return true;
@@ -522,14 +526,7 @@
       SSA.AddAvailableValue(ExitBlock, New);
   }
   
-  // If the instruction doesn't dominate any exit blocks, it must be dead.
-  if (NumInserted == 0) {
-    CurAST->deleteValue(&I);
-    if (!I.use_empty())
-      I.replaceAllUsesWith(UndefValue::get(I.getType()));
-    I.eraseFromParent();
-    return;
-  }
+  assert(NumInserted && "We shouldn't see dead instructions here!");
   
   // Next, rewrite uses of the instruction, inserting PHI nodes as needed.
   for (Value::use_iterator UI = I.use_begin(), UE = I.use_end(); UI != UE; ) {

Added: llvm/trunk/test/CodeGen/ARM/fast-isel-crash2.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/fast-isel-crash2.ll?rev=132194&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/ARM/fast-isel-crash2.ll (added)
+++ llvm/trunk/test/CodeGen/ARM/fast-isel-crash2.ll Fri May 27 13:02:04 2011
@@ -0,0 +1,9 @@
+; RUN: llc < %s -O0 -mtriple=thumbv7-apple-darwin
+; rdar://9515076
+; (Make sure this doesn't crash.)
+
+define i32 @test(i32 %i) {
+  %t = trunc i32 %1 to i4
+  %r = sext i4 %t to i32
+  ret i32 %r
+}





More information about the llvm-commits mailing list