diff options
author | Vitaly Buka <vitalybuka@google.com> | 2020-06-14 23:03:13 -0700 |
---|---|---|
committer | Vitaly Buka <vitalybuka@google.com> | 2020-06-14 23:05:43 -0700 |
commit | ca2dcbd030eadbf0aa9b660efe864ff08af6e18b (patch) | |
tree | b1f95ac203a93fc827bb2d679e63c81234661dc5 /llvm/lib/CodeGen/SafeStack.cpp | |
parent | c6426e2657d77a926f3ed476693505af7b538a72 (diff) | |
download | llvm-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.cpp | 9 |
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); |