Skip to content

Commit

Permalink
[BOLT] Remove ineligible macro-fusion patterns
Browse files Browse the repository at this point in the history
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)
  • Loading branch information
aaupov authored and maksfb committed Jan 7, 2022
1 parent 4243b65 commit 1d3c150
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions bolt/lib/Target/X86/X86MCPlusBuilder.cpp
Expand Up @@ -990,11 +990,16 @@ class X86MCPlusBuilder : public MCPlusBuilder {
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))
return false;
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.
Expand Down

0 comments on commit 1d3c150

Please sign in to comment.