diff options
author | Craig Topper <craig.topper@intel.com> | 2018-06-15 17:56:17 +0000 |
---|---|---|
committer | Craig Topper <craig.topper@intel.com> | 2018-06-15 17:56:17 +0000 |
commit | 1657b7b8d2036abb6d18f9aeb31497659be4f761 (patch) | |
tree | f54017e1dc4c34e6069368204f97fec0af43f7d0 /llvm/lib/Target/X86/X86InstrInfo.cpp | |
parent | 4217d170aa69f184b8777398a7f7bf8c3b6f4937 (diff) | |
download | bcm5719-llvm-1657b7b8d2036abb6d18f9aeb31497659be4f761.tar.gz bcm5719-llvm-1657b7b8d2036abb6d18f9aeb31497659be4f761.zip |
[X86] Prevent folding stack reloads into instructions in hasUndefRegUpdate.
An earlier commit prevented folds from the peephole pass by checking for IMPLICIT_DEF. But later in the pipeline IMPLICIT_DEF just becomes and Undef flag on the input register so we need to check for that case too.
llvm-svn: 334848
Diffstat (limited to 'llvm/lib/Target/X86/X86InstrInfo.cpp')
-rw-r--r-- | llvm/lib/Target/X86/X86InstrInfo.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/llvm/lib/Target/X86/X86InstrInfo.cpp b/llvm/lib/Target/X86/X86InstrInfo.cpp index 234de6ab703..6844bc64c8f 100644 --- a/llvm/lib/Target/X86/X86InstrInfo.cpp +++ b/llvm/lib/Target/X86/X86InstrInfo.cpp @@ -8916,12 +8916,18 @@ static bool shouldPreventUndefRegUpdateMemFold(MachineFunction &MF, MachineInstr if (MF.getFunction().optForSize() || !hasUndefRegUpdate(MI.getOpcode()) || !MI.getOperand(1).isReg()) return false; - + + // The are two cases we need to handle depending on where in the pipeline + // the folding attempt is being made. + // -Register has the undef flag set. + // -Register is produced by the IMPLICIT_DEF instruction. + + if (MI.getOperand(1).isUndef()) + return true; + MachineRegisterInfo &RegInfo = MF.getRegInfo(); MachineInstr *VRegDef = RegInfo.getUniqueVRegDef(MI.getOperand(1).getReg()); - if (VRegDef == nullptr) - return false; - return VRegDef->isImplicitDef(); + return VRegDef && VRegDef->isImplicitDef(); } |