Implement a small optimization, which papers over the problem in

X86/2004-04-13-FPCMOV-Crash.llx

A more robust fix is to follow.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12935 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2004-04-13 21:56:09 +00:00
parent 6de6a0a6f0
commit 82c5a9990f
2 changed files with 24 additions and 6 deletions

View File

@ -1038,6 +1038,17 @@ void ISel::emitSelectOperation(MachineBasicBlock *MBB,
FalseVal = ConstantExpr::getCast(F, Type::ShortTy);
}
unsigned TrueReg = getReg(TrueVal, MBB, IP);
unsigned FalseReg = getReg(FalseVal, MBB, IP);
if (TrueReg == FalseReg) {
static const unsigned Opcode[] = {
X86::MOV8rr, X86::MOV16rr, X86::MOV32rr, X86::FpMOV, X86::MOV32rr
};
BuildMI(*MBB, IP, Opcode[SelectClass], 1, DestReg).addReg(TrueReg);
if (SelectClass == cLong)
BuildMI(*MBB, IP, X86::MOV32rr, 1, DestReg+1).addReg(TrueReg+1);
return;
}
unsigned Opcode;
if (SetCondInst *SCI = canFoldSetCCIntoBranchOrSelect(Cond)) {
@ -1130,8 +1141,6 @@ void ISel::emitSelectOperation(MachineBasicBlock *MBB,
}
}
unsigned TrueReg = getReg(TrueVal, MBB, IP);
unsigned FalseReg = getReg(FalseVal, MBB, IP);
unsigned RealDestReg = DestReg;

View File

@ -1038,6 +1038,17 @@ void ISel::emitSelectOperation(MachineBasicBlock *MBB,
FalseVal = ConstantExpr::getCast(F, Type::ShortTy);
}
unsigned TrueReg = getReg(TrueVal, MBB, IP);
unsigned FalseReg = getReg(FalseVal, MBB, IP);
if (TrueReg == FalseReg) {
static const unsigned Opcode[] = {
X86::MOV8rr, X86::MOV16rr, X86::MOV32rr, X86::FpMOV, X86::MOV32rr
};
BuildMI(*MBB, IP, Opcode[SelectClass], 1, DestReg).addReg(TrueReg);
if (SelectClass == cLong)
BuildMI(*MBB, IP, X86::MOV32rr, 1, DestReg+1).addReg(TrueReg+1);
return;
}
unsigned Opcode;
if (SetCondInst *SCI = canFoldSetCCIntoBranchOrSelect(Cond)) {
@ -1130,8 +1141,6 @@ void ISel::emitSelectOperation(MachineBasicBlock *MBB,
}
}
unsigned TrueReg = getReg(TrueVal, MBB, IP);
unsigned FalseReg = getReg(FalseVal, MBB, IP);
unsigned RealDestReg = DestReg;