forked from OSchip/llvm-project
[BreakFalseDeps] Harden pickBestRegisterForUndef against changing tied 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.
This commit is contained in:
parent
57fb56b30e
commit
24b3c2d058
|
@ -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.
|
||||
|
|
Loading…
Reference in New Issue