summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/StackColoring.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/CodeGen/StackColoring.cpp')
-rw-r--r--llvm/lib/CodeGen/StackColoring.cpp21
1 files changed, 11 insertions, 10 deletions
diff --git a/llvm/lib/CodeGen/StackColoring.cpp b/llvm/lib/CodeGen/StackColoring.cpp
index 0bd941e64aa..f9d1eaf0307 100644
--- a/llvm/lib/CodeGen/StackColoring.cpp
+++ b/llvm/lib/CodeGen/StackColoring.cpp
@@ -39,7 +39,6 @@
#include "llvm/CodeGen/Passes.h"
#include "llvm/CodeGen/SelectionDAGNodes.h"
#include "llvm/CodeGen/SlotIndexes.h"
-#include "llvm/CodeGen/StackProtector.h"
#include "llvm/CodeGen/TargetOpcodes.h"
#include "llvm/CodeGen/WinEHFuncInfo.h"
#include "llvm/Config/llvm-config.h"
@@ -423,9 +422,6 @@ class StackColoring : public MachineFunctionPass {
/// SlotIndex analysis object.
SlotIndexes *Indexes;
- /// The stack protector object.
- StackProtector *SP;
-
/// The list of lifetime markers found. These markers are to be removed
/// once the coloring is done.
SmallVector<MachineInstr*, 8> Markers;
@@ -524,13 +520,11 @@ char &llvm::StackColoringID = StackColoring::ID;
INITIALIZE_PASS_BEGIN(StackColoring, DEBUG_TYPE,
"Merge disjoint stack slots", false, false)
INITIALIZE_PASS_DEPENDENCY(SlotIndexes)
-INITIALIZE_PASS_DEPENDENCY(StackProtector)
INITIALIZE_PASS_END(StackColoring, DEBUG_TYPE,
"Merge disjoint stack slots", false, false)
void StackColoring::getAnalysisUsage(AnalysisUsage &AU) const {
AU.addRequired<SlotIndexes>();
- AU.addRequired<StackProtector>();
MachineFunctionPass::getAnalysisUsage(AU);
}
@@ -936,9 +930,17 @@ void StackColoring::remapInstructions(DenseMap<int, int> &SlotRemap) {
MergedAllocas.insert(From);
MergedAllocas.insert(To);
- // Allow the stack protector to adjust its value map to account for the
- // upcoming replacement.
- SP->adjustForColoring(From, To);
+ // Transfer the stack protector layout tag, but make sure that SSPLK_AddrOf
+ // does not overwrite SSPLK_SmallArray or SSPLK_LargeArray, and make sure
+ // that SSPLK_SmallArray does not overwrite SSPLK_LargeArray.
+ MachineFrameInfo::SSPLayoutKind FromKind
+ = MFI->getObjectSSPLayout(SI.first);
+ MachineFrameInfo::SSPLayoutKind ToKind = MFI->getObjectSSPLayout(SI.second);
+ if (FromKind != MachineFrameInfo::SSPLK_None &&
+ (ToKind == MachineFrameInfo::SSPLK_None ||
+ (ToKind != MachineFrameInfo::SSPLK_LargeArray &&
+ FromKind != MachineFrameInfo::SSPLK_AddrOf)))
+ MFI->setObjectSSPLayout(SI.second, FromKind);
// The new alloca might not be valid in a llvm.dbg.declare for this
// variable, so undef out the use to make the verifier happy.
@@ -1139,7 +1141,6 @@ bool StackColoring::runOnMachineFunction(MachineFunction &Func) {
MF = &Func;
MFI = &MF->getFrameInfo();
Indexes = &getAnalysis<SlotIndexes>();
- SP = &getAnalysis<StackProtector>();
BlockLiveness.clear();
BasicBlocks.clear();
BasicBlockNumbering.clear();
OpenPOWER on IntegriCloud