summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorFangrui Song <maskray@google.com>2020-01-27 10:39:49 -0500
committerFangrui Song <maskray@google.com>2020-01-27 16:39:56 -0800
commit87c7863c3ec4b66944bfcf39efd666de417f28b8 (patch)
tree1a843ee38208aead3a4dc59f10dd9c91ea233a6e /llvm/lib
parentc23212a438f6ff20bf1d98e5ca23c5cd28591ce3 (diff)
downloadbcm5719-llvm-87c7863c3ec4b66944bfcf39efd666de417f28b8.tar.gz
bcm5719-llvm-87c7863c3ec4b66944bfcf39efd666de417f28b8.zip
Reland "[StackColoring] Remap PseudoSourceValue frame indices via MachineFunction::getPSVManager()""
Reland 7a8b0b1595e7dc878b48cf9bbaa652087a6895db, with a fix that checks `!E.value().empty()` to avoid inserting a zero to SlotRemap. Debugged by rnk@ in https://bugs.chromium.org/p/chromium/issues/detail?id=1045650#c33 Reviewed By: rnk Differential Revision: https://reviews.llvm.org/D73510 (cherry picked from commit 68051c122440b556e88a946bce12bae58fcfccb4) (cherry picked from commit c7c5da6df30141c563e1f5b8ddeabeecdd29e55e)
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/CodeGen/StackColoring.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/llvm/lib/CodeGen/StackColoring.cpp b/llvm/lib/CodeGen/StackColoring.cpp
index 40bc36c3030..9d4fdc6b624 100644
--- a/llvm/lib/CodeGen/StackColoring.cpp
+++ b/llvm/lib/CodeGen/StackColoring.cpp
@@ -960,7 +960,8 @@ void StackColoring::remapInstructions(DenseMap<int, int> &SlotRemap) {
}
// Remap all instructions to the new stack slots.
- std::vector<std::vector<MachineMemOperand *>> SSRefs(MFI->getObjectIndexEnd());
+ std::vector<std::vector<MachineMemOperand *>> SSRefs(
+ MFI->getObjectIndexEnd());
for (MachineBasicBlock &BB : *MF)
for (MachineInstr &I : BB) {
// Skip lifetime markers. We'll remove them soon.
@@ -1074,12 +1075,13 @@ void StackColoring::remapInstructions(DenseMap<int, int> &SlotRemap) {
}
// Rewrite MachineMemOperands that reference old frame indices.
- for (auto E : enumerate(SSRefs)) {
- const PseudoSourceValue *NewSV =
- MF->getPSVManager().getFixedStack(SlotRemap[E.index()]);
- for (MachineMemOperand *Ref : E.value())
- Ref->setValue(NewSV);
- }
+ for (auto E : enumerate(SSRefs))
+ if (!E.value().empty()) {
+ const PseudoSourceValue *NewSV =
+ MF->getPSVManager().getFixedStack(SlotRemap.find(E.index())->second);
+ for (MachineMemOperand *Ref : E.value())
+ Ref->setValue(NewSV);
+ }
// Update the location of C++ catch objects for the MSVC personality routine.
if (WinEHFuncInfo *EHInfo = MF->getWinEHFuncInfo())
OpenPOWER on IntegriCloud