llvm.org GIT mirror llvm / b0869ed
It's not safe to rematerialize MOV32r0 etc. by simply cloning the original instruction. These are implemented with xor which will modify the conditional code. They should be rematerialized as move instructions. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41802 91177308-0d34-0410-b5e6-96231b3b80d8 Evan Cheng 13 years ago
1 changed file(s) with 22 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
264264 MachineBasicBlock::iterator I,
265265 unsigned DestReg,
266266 const MachineInstr *Orig) const {
267 MachineInstr *MI = Orig->clone();
268 MI->getOperand(0).setReg(DestReg);
269 MBB.insert(I, MI);
267 // MOV32r0 etc. are implemented with xor which clobbers condition code.
268 // Re-materialize them as movri instructions to avoid side effects.
269 switch (Orig->getOpcode()) {
270 case X86::MOV8r0:
271 BuildMI(MBB, I, TII.get(X86::MOV8ri), DestReg).addImm(0);
272 break;
273 case X86::MOV16r0:
274 BuildMI(MBB, I, TII.get(X86::MOV16ri), DestReg).addImm(0);
275 break;
276 case X86::MOV32r0:
277 BuildMI(MBB, I, TII.get(X86::MOV32ri), DestReg).addImm(0);
278 break;
279 case X86::MOV64r0:
280 BuildMI(MBB, I, TII.get(X86::MOV64ri32), DestReg).addImm(0);
281 break;
282 default: {
283 MachineInstr *MI = Orig->clone();
284 MI->getOperand(0).setReg(DestReg);
285 MBB.insert(I, MI);
286 break;
287 }
288 }
270289 }
271290
272291 static const MachineInstrBuilder &FuseInstrAddOperand(MachineInstrBuilder &MIB,