[FastISel] Fix a potential bug in FastEmitInst_ri
authorJuergen Ributzka <juergen@apple.com>
Wed, 27 Aug 2014 20:47:33 +0000 (20:47 +0000)
committerJuergen Ributzka <juergen@apple.com>
Wed, 27 Aug 2014 20:47:33 +0000 (20:47 +0000)
FastEmitInst_ri was constraining the first operand without checking if it is
a virtual register. Use constrainOperandRegClass as all the other
FastEmitInst_* functions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216613 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/SelectionDAG/FastISel.cpp

index ec0531e04d4e9486f94443a82747e347315eabf9..0a81662e9a3efb53a588491f2c3ddadc4b00cde2 100644 (file)
@@ -1816,8 +1816,7 @@ unsigned FastISel::FastEmitInst_ri(unsigned MachineInstOpcode,
   const MCInstrDesc &II = TII.get(MachineInstOpcode);
 
   unsigned ResultReg = createResultReg(RC);
-  RC = TII.getRegClass(II, II.getNumDefs(), &TRI, *FuncInfo.MF);
-  MRI.constrainRegClass(Op0, RC);
+  Op0 = constrainOperandRegClass(II, Op0, II.getNumDefs());
 
   if (II.getNumDefs() >= 1)
     BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DbgLoc, II, ResultReg)