summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
authorQuentin Colombet <qcolombet@apple.com>2017-06-07 00:22:07 +0000
committerQuentin Colombet <qcolombet@apple.com>2017-06-07 00:22:07 +0000
commit9e9d63867633502611f4f5278779d45f28d7cfbe (patch)
treec834a136978b0292d996b48bfe87c65d3fc97bd2 /llvm/lib/CodeGen
parentf57015d4cc92ad7721ab52be4ba26e94b3a379e9 (diff)
downloadbcm5719-llvm-9e9d63867633502611f4f5278779d45f28d7cfbe.tar.gz
bcm5719-llvm-9e9d63867633502611f4f5278779d45f28d7cfbe.zip
[InlineSpiller] Only account for real spills in the hoisting logic
Spills of undef values shouldn't impact the placement of the relevant spills. Drive by review. llvm-svn: 304850
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/InlineSpiller.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/InlineSpiller.cpp b/llvm/lib/CodeGen/InlineSpiller.cpp
index 68f2a2ed9a1..4e6a3ec2186 100644
--- a/llvm/lib/CodeGen/InlineSpiller.cpp
+++ b/llvm/lib/CodeGen/InlineSpiller.cpp
@@ -877,14 +877,16 @@ void InlineSpiller::insertSpill(unsigned NewVReg, bool isKill,
MachineBasicBlock &MBB = *MI->getParent();
MachineInstrSpan MIS(MI);
- if (isFullUndefDef(*MI))
+ bool IsRealSpill = true;
+ if (isFullUndefDef(*MI)) {
// Don't spill undef value.
// Anything works for undef, in particular keeping the memory
// uninitialized is a viable option and it saves code size and
// run time.
BuildMI(MBB, std::next(MI), MI->getDebugLoc(), TII.get(TargetOpcode::KILL))
.addReg(NewVReg, getKillRegState(isKill));
- else
+ IsRealSpill = false;
+ } else
TII.storeRegToStackSlot(MBB, std::next(MI), NewVReg, isKill, StackSlot,
MRI.getRegClass(NewVReg), &TRI);
@@ -893,7 +895,8 @@ void InlineSpiller::insertSpill(unsigned NewVReg, bool isKill,
DEBUG(dumpMachineInstrRangeWithSlotIndex(std::next(MI), MIS.end(), LIS,
"spill"));
++NumSpills;
- HSpiller.addToMergeableSpills(*std::next(MI), StackSlot, Original);
+ if (IsRealSpill)
+ HSpiller.addToMergeableSpills(*std::next(MI), StackSlot, Original);
}
/// spillAroundUses - insert spill code around each use of Reg.
OpenPOWER on IntegriCloud