diff options
author | Vitaly Buka <vitalybuka@google.com> | 2020-06-14 15:32:07 -0700 |
---|---|---|
committer | Vitaly Buka <vitalybuka@google.com> | 2020-06-14 23:05:41 -0700 |
commit | f8e411656e5b324284822d67e7230f18ad547fc4 (patch) | |
tree | 3d1739b619f128931db252503436bb5ec733e225 /llvm/lib/CodeGen/SafeStack.cpp | |
parent | 05590a9cb8717e2db0aa274047f1b00c5ab51a8d (diff) | |
download | llvm-f8e411656e5b324284822d67e7230f18ad547fc4.zip llvm-f8e411656e5b324284822d67e7230f18ad547fc4.tar.gz llvm-f8e411656e5b324284822d67e7230f18ad547fc4.tar.bz2 |
[SafeStack,NFC] Move ClColoring into SafeStack.cpp
This allows to reuse the code in other components.
Diffstat (limited to 'llvm/lib/CodeGen/SafeStack.cpp')
-rw-r--r-- | llvm/lib/CodeGen/SafeStack.cpp | 12 |
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(); |