mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-09-13 08:25:27 +00:00
Add SrcReg2 to analyzeCompare and optimizeCompareInstr to handle Compare
instructions with two register operands. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159465 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -368,14 +368,15 @@ bool PeepholeOptimizer::optimizeCmpInstr(MachineInstr *MI,
|
||||
MachineBasicBlock *MBB) {
|
||||
// If this instruction is a comparison against zero and isn't comparing a
|
||||
// physical register, we can try to optimize it.
|
||||
unsigned SrcReg;
|
||||
unsigned SrcReg, SrcReg2;
|
||||
int CmpMask, CmpValue;
|
||||
if (!TII->AnalyzeCompare(MI, SrcReg, CmpMask, CmpValue) ||
|
||||
TargetRegisterInfo::isPhysicalRegister(SrcReg))
|
||||
if (!TII->analyzeCompare(MI, SrcReg, SrcReg2, CmpMask, CmpValue) ||
|
||||
TargetRegisterInfo::isPhysicalRegister(SrcReg) ||
|
||||
(SrcReg2 != 0 && TargetRegisterInfo::isPhysicalRegister(SrcReg2)))
|
||||
return false;
|
||||
|
||||
// Attempt to optimize the comparison instruction.
|
||||
if (TII->OptimizeCompareInstr(MI, SrcReg, CmpMask, CmpValue, MRI)) {
|
||||
if (TII->optimizeCompareInstr(MI, SrcReg, SrcReg2, CmpMask, CmpValue, MRI)) {
|
||||
++NumCmps;
|
||||
return true;
|
||||
}
|
||||
|
Reference in New Issue
Block a user