aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/SafeStack.cpp
diff options
context:
space:
mode:
authorVitaly Buka <vitalybuka@google.com>2020-06-14 23:03:13 -0700
committerVitaly Buka <vitalybuka@google.com>2020-06-14 23:05:43 -0700
commitca2dcbd030eadbf0aa9b660efe864ff08af6e18b (patch)
treeb1f95ac203a93fc827bb2d679e63c81234661dc5 /llvm/lib/CodeGen/SafeStack.cpp
parentc6426e2657d77a926f3ed476693505af7b538a72 (diff)
downloadllvm-ca2dcbd030eadbf0aa9b660efe864ff08af6e18b.zip
llvm-ca2dcbd030eadbf0aa9b660efe864ff08af6e18b.tar.gz
llvm-ca2dcbd030eadbf0aa9b660efe864ff08af6e18b.tar.bz2
[SafeStack,NFC] Make StackColoring read-only
Move core which removes markers out of StackColoring.
Diffstat (limited to 'llvm/lib/CodeGen/SafeStack.cpp')
-rw-r--r--llvm/lib/CodeGen/SafeStack.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/SafeStack.cpp b/llvm/lib/CodeGen/SafeStack.cpp
index 7886bf3..63c4e94 100644
--- a/llvm/lib/CodeGen/SafeStack.cpp
+++ b/llvm/lib/CodeGen/SafeStack.cpp
@@ -501,7 +501,14 @@ Value *SafeStack::moveStaticAllocasToUnsafeStack(
static const StackColoring::LiveRange NoColoringRange(1, true);
if (ClColoring)
SSC.run();
- SSC.removeAllMarkers();
+
+ for (auto *I : SSC.getMarkers()) {
+ auto *Op = dyn_cast<Instruction>(I->getOperand(1));
+ const_cast<IntrinsicInst *>(I)->eraseFromParent();
+ // Remove the operand bitcast, too, if it has no more uses left.
+ if (Op && Op->use_empty())
+ Op->eraseFromParent();
+ }
// Unsafe stack always grows down.
StackLayout SSL(StackAlignment);