aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/SafeStack.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/CodeGen/SafeStack.cpp')
-rw-r--r--llvm/lib/CodeGen/SafeStack.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/SafeStack.cpp b/llvm/lib/CodeGen/SafeStack.cpp
index 001df8b..626e318d 100644
--- a/llvm/lib/CodeGen/SafeStack.cpp
+++ b/llvm/lib/CodeGen/SafeStack.cpp
@@ -18,6 +18,7 @@
#include "SafeStackLayout.h"
#include "llvm/ADT/APInt.h"
#include "llvm/ADT/ArrayRef.h"
+#include "llvm/ADT/BitVector.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Statistic.h"
@@ -95,6 +96,10 @@ static cl::opt<bool>
SafeStackUsePointerAddress("safestack-use-pointer-address",
cl::init(false), cl::Hidden);
+// Disabled by default due to PR32143.
+static cl::opt<bool> ClColoring("safe-stack-coloring",
+ cl::desc("enable safe stack coloring"),
+ cl::Hidden, cl::init(false));
namespace {
@@ -493,7 +498,9 @@ Value *SafeStack::moveStaticAllocasToUnsafeStack(
DIBuilder DIB(*F.getParent());
StackColoring SSC(F, StaticAllocas);
- SSC.run();
+ static const StackColoring::LiveRange NoColoringRange = {BitVector{1, true}};
+ if (ClColoring)
+ SSC.run();
SSC.removeAllMarkers();
// Unsafe stack always grows down.
@@ -528,7 +535,8 @@ Value *SafeStack::moveStaticAllocasToUnsafeStack(
unsigned Align =
std::max((unsigned)DL.getPrefTypeAlignment(Ty), AI->getAlignment());
- SSL.addObject(AI, Size, Align, SSC.getLiveRange(AI));
+ SSL.addObject(AI, Size, Align,
+ ClColoring ? SSC.getLiveRange(AI) : NoColoringRange);
}
SSL.computeLayout();