From ca2dcbd030eadbf0aa9b660efe864ff08af6e18b Mon Sep 17 00:00:00 2001 From: Vitaly Buka Date: Sun, 14 Jun 2020 23:03:13 -0700 Subject: [SafeStack,NFC] Make StackColoring read-only Move core which removes markers out of StackColoring. --- llvm/lib/CodeGen/SafeStack.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'llvm/lib/CodeGen/SafeStack.cpp') 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(I->getOperand(1)); + const_cast(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); -- cgit v1.1