mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-14 11:32:34 +00:00
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:
parent
6de6a0a6f0
commit
82c5a9990f
@ -1038,7 +1038,18 @@ 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)) {
|
||||
// We successfully folded the setcc into the select instruction.
|
||||
@ -1130,8 +1141,6 @@ void ISel::emitSelectOperation(MachineBasicBlock *MBB,
|
||||
}
|
||||
}
|
||||
|
||||
unsigned TrueReg = getReg(TrueVal, MBB, IP);
|
||||
unsigned FalseReg = getReg(FalseVal, MBB, IP);
|
||||
unsigned RealDestReg = DestReg;
|
||||
|
||||
|
||||
|
@ -1038,7 +1038,18 @@ 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)) {
|
||||
// We successfully folded the setcc into the select instruction.
|
||||
@ -1130,8 +1141,6 @@ void ISel::emitSelectOperation(MachineBasicBlock *MBB,
|
||||
}
|
||||
}
|
||||
|
||||
unsigned TrueReg = getReg(TrueVal, MBB, IP);
|
||||
unsigned FalseReg = getReg(FalseVal, MBB, IP);
|
||||
unsigned RealDestReg = DestReg;
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user