Skip to content

Commit

Permalink
[BreakFalseDeps] Harden pickBestRegisterForUndef against changing tie…
Browse files Browse the repository at this point in the history
…d operands or physical registers that aren't renamable.

I don't have any test cases since X86 doesn't return any tied
operands from getUndefRegClearance today. But conceivably we could
want BreakFalseDeps to insert a dependency breaking XOR for
a tied operand in the future.
  • Loading branch information
topperc committed May 9, 2020
1 parent 57fb56b commit 24b3c2d
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions llvm/lib/CodeGen/BreakFalseDeps.cpp
Expand Up @@ -106,9 +106,18 @@ FunctionPass *llvm::createBreakFalseDeps() { return new BreakFalseDeps(); }

bool BreakFalseDeps::pickBestRegisterForUndef(MachineInstr *MI, unsigned OpIdx,
unsigned Pref) {

// We can't change tied operands.
if (MI->isRegTiedToDefOperand(OpIdx))
return false;

MachineOperand &MO = MI->getOperand(OpIdx);
assert(MO.isUndef() && "Expected undef machine operand");

// We can't change registers that aren't renamable.
if (!MO.isRenamable())
return false;

Register OriginalReg = MO.getReg();

// Update only undef operands that have reg units that are mapped to one root.
Expand Down

0 comments on commit 24b3c2d

Please sign in to comment.