summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorGeoff Berry <gberry@codeaurora.org>2018-05-04 19:25:09 +0000
committerGeoff Berry <gberry@codeaurora.org>2018-05-04 19:25:09 +0000
commit8e4958e760f0af8174d96ab940f2d01caf251528 (patch)
tree2764947f6bbc5328b6c8902d83f75f971f7f155e /llvm/lib
parent57fadab1cbe319958e3da8700ab38a91fde82c53 (diff)
downloadbcm5719-llvm-8e4958e760f0af8174d96ab940f2d01caf251528.tar.gz
bcm5719-llvm-8e4958e760f0af8174d96ab940f2d01caf251528.zip
[MachineLICM] Debug intrinsics shouldn't affect hoist decisions
Summary: When checking if an instruction stores to a given frame index, check that the instruction can write to memory before looking at the memory operands list to avoid e.g. DBG_VALUE instructions that reference a frame index preventing a load from that index from being hoisted. Reviewers: dblaikie, MatzeB, qcolombet, reames, javed.absar Subscribers: mcrosier, llvm-commits Differential Revision: https://reviews.llvm.org/D46284 llvm-svn: 331549
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/CodeGen/MachineLICM.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/MachineLICM.cpp b/llvm/lib/CodeGen/MachineLICM.cpp
index d3a77ab4945..0ad3ef18e55 100644
--- a/llvm/lib/CodeGen/MachineLICM.cpp
+++ b/llvm/lib/CodeGen/MachineLICM.cpp
@@ -374,6 +374,10 @@ bool MachineLICMBase::runOnMachineFunction(MachineFunction &MF) {
/// Return true if instruction stores to the specified frame.
static bool InstructionStoresToFI(const MachineInstr *MI, int FI) {
+ // Check mayStore before memory operands so that e.g. DBG_VALUEs will return
+ // true since they have no memory operands.
+ if (!MI->mayStore())
+ return false;
// If we lost memory operands, conservatively assume that the instruction
// writes to all slots.
if (MI->memoperands_empty())
OpenPOWER on IntegriCloud