diff options
author | Hans Wennborg <hans@hanshq.net> | 2019-05-09 09:22:56 +0000 |
---|---|---|
committer | Hans Wennborg <hans@hanshq.net> | 2019-05-09 09:22:56 +0000 |
commit | b1b09e5b55fafe57629878fbdd8cc4b02a9d189e (patch) | |
tree | 5ea461562d989a8b3be3f1deb0dda1a2e7e3ebf7 /llvm/lib/Target/X86/X86WinAllocaExpander.cpp | |
parent | fa18e6b080b8f2db3640e100ba03af7131b383cb (diff) | |
download | bcm5719-llvm-b1b09e5b55fafe57629878fbdd8cc4b02a9d189e.tar.gz bcm5719-llvm-b1b09e5b55fafe57629878fbdd8cc4b02a9d189e.zip |
X86WinAllocaExpander: Drop code looking through register copies (PR41786)
This code was never covered by tests, in PR41786 it was pointed out that
the deletion part doesn't work, and in a full Chrome build I was never
able to hit the code path that looks through copies. It seems the
situation it's supposed to handle doesn't actually come up in practice.
Delete it to simplify the code.
Differential revision: https://reviews.llvm.org/D61671
llvm-svn: 360320
Diffstat (limited to 'llvm/lib/Target/X86/X86WinAllocaExpander.cpp')
-rw-r--r-- | llvm/lib/Target/X86/X86WinAllocaExpander.cpp | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/llvm/lib/Target/X86/X86WinAllocaExpander.cpp b/llvm/lib/Target/X86/X86WinAllocaExpander.cpp index aa2c872403a..22d168c1e39 100644 --- a/llvm/lib/Target/X86/X86WinAllocaExpander.cpp +++ b/llvm/lib/Target/X86/X86WinAllocaExpander.cpp @@ -84,10 +84,6 @@ static int64_t getWinAllocaAmount(MachineInstr *MI, MachineRegisterInfo *MRI) { unsigned AmountReg = MI->getOperand(0).getReg(); MachineInstr *Def = MRI->getUniqueVRegDef(AmountReg); - // Look through copies. - while (Def && Def->isCopy() && Def->getOperand(1).isReg()) - Def = MRI->getUniqueVRegDef(Def->getOperand(1).getReg()); - if (!Def || (Def->getOpcode() != X86::MOV32ri && Def->getOpcode() != X86::MOV64ri) || !Def->getOperand(1).isImm()) @@ -268,18 +264,10 @@ void X86WinAllocaExpander::lower(MachineInstr* MI, Lowering L) { unsigned AmountReg = MI->getOperand(0).getReg(); MI->eraseFromParent(); - // Delete the definition of AmountReg, possibly walking a chain of copies. - for (;;) { - if (!MRI->use_empty(AmountReg)) - break; - MachineInstr *AmountDef = MRI->getUniqueVRegDef(AmountReg); - if (!AmountDef) - break; - if (AmountDef->isCopy() && AmountDef->getOperand(1).isReg()) - AmountReg = AmountDef->getOperand(1).isReg(); - AmountDef->eraseFromParent(); - break; - } + // Delete the definition of AmountReg. + if (MRI->use_empty(AmountReg)) + if (MachineInstr *AmountDef = MRI->getUniqueVRegDef(AmountReg)) + AmountDef->eraseFromParent(); } bool X86WinAllocaExpander::runOnMachineFunction(MachineFunction &MF) { |