[llvm] r360320 - X86WinAllocaExpander: Drop code looking through register copies (PR41786)
Hans Wennborg via llvm-commits
llvm-commits at lists.llvm.org
Thu May 9 02:22:56 PDT 2019
Author: hans
Date: Thu May 9 02:22:56 2019
New Revision: 360320
URL: http://llvm.org/viewvc/llvm-project?rev=360320&view=rev
Log:
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
Modified:
llvm/trunk/lib/Target/X86/X86WinAllocaExpander.cpp
Modified: llvm/trunk/lib/Target/X86/X86WinAllocaExpander.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86WinAllocaExpander.cpp?rev=360320&r1=360319&r2=360320&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86WinAllocaExpander.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86WinAllocaExpander.cpp Thu May 9 02:22:56 2019
@@ -84,10 +84,6 @@ static int64_t getWinAllocaAmount(Machin
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(Machine
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) {
More information about the llvm-commits
mailing list