aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/LocalStackSlotAllocation.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/CodeGen/LocalStackSlotAllocation.cpp')
-rw-r--r--lib/CodeGen/LocalStackSlotAllocation.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/CodeGen/LocalStackSlotAllocation.cpp b/lib/CodeGen/LocalStackSlotAllocation.cpp
index b14d76a585f7..2392d4d00b56 100644
--- a/lib/CodeGen/LocalStackSlotAllocation.cpp
+++ b/lib/CodeGen/LocalStackSlotAllocation.cpp
@@ -261,7 +261,7 @@ void LocalStackSlotPass::calculateFrameObjectOffsets(MachineFunction &Fn) {
// Remember how big this blob of stack space is
MFI.setLocalFrameSize(Offset);
- MFI.setLocalFrameMaxAlign(MaxAlign);
+ MFI.setLocalFrameMaxAlign(assumeAligned(MaxAlign));
}
static inline bool
@@ -351,6 +351,14 @@ bool LocalStackSlotPass::insertFrameReferenceRegisters(MachineFunction &Fn) {
assert(MFI.isObjectPreAllocated(FrameIdx) &&
"Only pre-allocated locals expected!");
+ // We need to keep the references to the stack protector slot through frame
+ // index operands so that it gets resolved by PEI rather than this pass.
+ // This avoids accesses to the stack protector though virtual base
+ // registers, and forces PEI to address it using fp/sp/bp.
+ if (MFI.hasStackProtectorIndex() &&
+ FrameIdx == MFI.getStackProtectorIndex())
+ continue;
+
LLVM_DEBUG(dbgs() << "Considering: " << MI);
unsigned idx = 0;