diff options
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/FastISel.cpp | 8 | 
1 files changed, 6 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp b/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp index 2b624adac94..13f0cb3900f 100644 --- a/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp @@ -1675,6 +1675,7 @@ unsigned FastISel::fastEmit_ri_(MVT VT, unsigned Opcode, unsigned Op0,    if (ResultReg)      return ResultReg;    unsigned MaterialReg = fastEmit_i(ImmType, ImmType, ISD::Constant, Imm); +  bool IsImmKill = true;    if (!MaterialReg) {      // This is a bit ugly/slow, but failing here means falling out of      // fast-isel, which would be very slow. @@ -1683,9 +1684,12 @@ unsigned FastISel::fastEmit_ri_(MVT VT, unsigned Opcode, unsigned Op0,      MaterialReg = getRegForValue(ConstantInt::get(ITy, Imm));      if (!MaterialReg)        return 0; +    // If this constant was already materialized, then we don't want to kill it. +    // In this case we will have a use. +    if (!MRI.use_empty(MaterialReg)) +      IsImmKill = false;    } -  return fastEmit_rr(VT, VT, Opcode, Op0, Op0IsKill, MaterialReg, -                     /*IsKill=*/true); +  return fastEmit_rr(VT, VT, Opcode, Op0, Op0IsKill, MaterialReg, IsImmKill);  }  unsigned FastISel::createResultReg(const TargetRegisterClass *RC) {  | 

