mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 20:51:52 +01:00
[SafeStack,NFC] Make StackColoring read-only
Move core which removes markers out of StackColoring.
This commit is contained in:
parent
3c4075434b
commit
22b9601a83
@ -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);
|
||||
|
@ -42,14 +42,12 @@ static bool readMarker(const Instruction *I, bool *IsStart) {
|
||||
return true;
|
||||
}
|
||||
|
||||
void StackColoring::removeAllMarkers() {
|
||||
for (auto *I : Markers) {
|
||||
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();
|
||||
}
|
||||
std::vector<const IntrinsicInst *> StackColoring::getMarkers() const {
|
||||
std::vector<const IntrinsicInst *> Markers;
|
||||
for (auto &M : InstructionNumbering)
|
||||
if (M.getFirst()->isLifetimeStartOrEnd())
|
||||
Markers.push_back(M.getFirst());
|
||||
return Markers;
|
||||
}
|
||||
|
||||
void StackColoring::collectMarkers() {
|
||||
@ -78,7 +76,6 @@ void StackColoring::collectMarkers() {
|
||||
if (IsStart)
|
||||
InterestingAllocas.set(AllocaNo);
|
||||
BBMarkerSet[UI->getParent()][UI] = {AllocaNo, IsStart};
|
||||
Markers.push_back(UI);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -102,7 +102,6 @@ private:
|
||||
/// The set of allocas that have at least one lifetime.start. All other
|
||||
/// allocas get LiveRange that corresponds to the entire function.
|
||||
BitVector InterestingAllocas;
|
||||
SmallVector<const IntrinsicInst *, 8> Markers;
|
||||
|
||||
struct Marker {
|
||||
unsigned AllocaNo;
|
||||
@ -125,7 +124,7 @@ public:
|
||||
StackColoring(const Function &F, ArrayRef<const AllocaInst *> Allocas);
|
||||
|
||||
void run();
|
||||
void removeAllMarkers();
|
||||
std::vector<const IntrinsicInst *> getMarkers() const;
|
||||
|
||||
/// Returns a set of "interesting" instructions where the given alloca is
|
||||
/// live. Not all instructions in a function are interesting: we pick a set
|
||||
|
Loading…
x
Reference in New Issue
Block a user