[llvm] r178305 - [fast-isel] Add a preemptive fix for the case where we fail to materialize an

Chad Rosier mcrosier at apple.com
Thu Mar 28 16:04:47 PDT 2013


Author: mcrosier
Date: Thu Mar 28 18:04:47 2013
New Revision: 178305

URL: http://llvm.org/viewvc/llvm-project?rev=178305&view=rev
Log:
[fast-isel] Add a preemptive fix for the case where we fail to materialize an
immediate in a register.  I don't believe this should ever fail, but I see no
harm in trying to make this code bullet proof.

I've added an assert to ensure my assumtion is correct.  If the assertion fires
something is wrong and we should fix it, rather then just silently fall back to
SelectionDAG isel.

Modified:
    llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp?rev=178305&r1=178304&r2=178305&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp Thu Mar 28 18:04:47 2013
@@ -1183,6 +1183,8 @@ unsigned FastISel::FastEmit_ri_(MVT VT,
     IntegerType *ITy = IntegerType::get(FuncInfo.Fn->getContext(),
                                               VT.getSizeInBits());
     MaterialReg = getRegForValue(ConstantInt::get(ITy, Imm));
+    assert (MaterialReg != 0 && "Unable to materialize imm.");
+    if (MaterialReg == 0) return 0;
   }
   return FastEmit_rr(VT, VT, Opcode,
                      Op0, Op0IsKill,





More information about the llvm-commits mailing list