diff options
author | Chad Rosier <mcrosier@apple.com> | 2013-03-28 23:04:47 +0000 |
---|---|---|
committer | Chad Rosier <mcrosier@apple.com> | 2013-03-28 23:04:47 +0000 |
commit | 7ae3bb83c278e991940d022b7b48d996da408abf (patch) | |
tree | d997e7eab01f9b7caf7976ad8fe694bf7d05875d /lib/CodeGen/SelectionDAG/FastISel.cpp | |
parent | 94fcfaf3a9f1179edb3b8053fe7b23eab6fb83bb (diff) |
[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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@178305 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/SelectionDAG/FastISel.cpp')
-rw-r--r-- | lib/CodeGen/SelectionDAG/FastISel.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/CodeGen/SelectionDAG/FastISel.cpp b/lib/CodeGen/SelectionDAG/FastISel.cpp index 10e2dc6149..9ac738e507 100644 --- a/lib/CodeGen/SelectionDAG/FastISel.cpp +++ b/lib/CodeGen/SelectionDAG/FastISel.cpp @@ -1183,6 +1183,8 @@ unsigned FastISel::FastEmit_ri_(MVT VT, unsigned Opcode, 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, |