diff options
author | Matthias Braun <matze@braunis.de> | 2018-07-12 19:27:01 +0000 |
---|---|---|
committer | Matthias Braun <matze@braunis.de> | 2018-07-12 19:27:01 +0000 |
commit | f03f32d4784f2b808dfdff568bcc023331e96cdb (patch) | |
tree | 3398d97fed255cd62ad65858111770b6beaf2e11 /llvm/lib/CodeGen/StackColoring.cpp | |
parent | 762dee516c3b1d4d1cf7d8c34921977fd1d60c5a (diff) | |
download | bcm5719-llvm-f03f32d4784f2b808dfdff568bcc023331e96cdb.tar.gz bcm5719-llvm-f03f32d4784f2b808dfdff568bcc023331e96cdb.zip |
Revert "(HEAD -> master, origin/master, arcpatch-D37582) CodeGen: Remove pipeline dependencies on StackProtector; NFC"
This was triggering pass scheduling failures.
This reverts commit r336929.
llvm-svn: 336934
Diffstat (limited to 'llvm/lib/CodeGen/StackColoring.cpp')
-rw-r--r-- | llvm/lib/CodeGen/StackColoring.cpp | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/llvm/lib/CodeGen/StackColoring.cpp b/llvm/lib/CodeGen/StackColoring.cpp index f9d1eaf0307..0bd941e64aa 100644 --- a/llvm/lib/CodeGen/StackColoring.cpp +++ b/llvm/lib/CodeGen/StackColoring.cpp @@ -39,6 +39,7 @@ #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" @@ -422,6 +423,9 @@ 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; @@ -520,11 +524,13 @@ 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); } @@ -930,17 +936,9 @@ void StackColoring::remapInstructions(DenseMap<int, int> &SlotRemap) { MergedAllocas.insert(From); MergedAllocas.insert(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); + // Allow the stack protector to adjust its value map to account for the + // upcoming replacement. + SP->adjustForColoring(From, To); // 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. @@ -1141,6 +1139,7 @@ bool StackColoring::runOnMachineFunction(MachineFunction &Func) { MF = &Func; MFI = &MF->getFrameInfo(); Indexes = &getAnalysis<SlotIndexes>(); + SP = &getAnalysis<StackProtector>(); BlockLiveness.clear(); BasicBlocks.clear(); BasicBlockNumbering.clear(); |