[BOLT] Remove ineligible macro-fusion patterns

Summary:
Remove patterns ineligible for macro-fusion:
- First instruction has a memory destination

This is a temporary commit to align BOLT with LLVM MC interfaces.
(cherry picked from FBD33479340)
This commit is contained in:
Amir Ayupov 2022-01-07 09:40:04 -08:00 committed by Maksim Panchenko
parent 4243b6582c
commit 1d3c150748
1 changed files with 8 additions and 3 deletions

View File

@ -990,11 +990,16 @@ public:
SecondInst.getOpcode() == X86::JRCXZ)
return false;
// Cannot fuse if first instruction operands are MEM-IMM.
const MCInstrDesc &Desc = Info->get(FirstInst.getOpcode());
int MemOpNo = X86II::getMemoryOperandNo(Desc.TSFlags);
if (MemOpNo != -1 && X86II::hasImm(Desc.TSFlags))
if (MemOpNo != -1) {
// Cannot fuse if first instruction operands are MEM-IMM.
if (X86II::hasImm(Desc.TSFlags))
return false;
// Cannot fuse if first instruction may store.
if (Desc.mayStore())
return false;
}
// Cannot fuse if the first instruction uses RIP-relative memory.
// FIXME: verify that this is true.