From d76f6eadc8c8511e1c5cd089a8a54e429c19aa60 Mon Sep 17 00:00:00 2001 From: Nadav Rotem Date: Wed, 12 Sep 2012 11:06:26 +0000 Subject: Add a flag to disable the code that looks for allocas which escaped the lifetime regions. This is useful for debugging. No testcase because without this check we fail on assertions when finding escaped allocas. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@163702 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/StackColoring.cpp | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) (limited to 'lib/CodeGen/StackColoring.cpp') diff --git a/lib/CodeGen/StackColoring.cpp b/lib/CodeGen/StackColoring.cpp index 0deb35ad7f..a14d730025 100644 --- a/lib/CodeGen/StackColoring.cpp +++ b/lib/CodeGen/StackColoring.cpp @@ -59,12 +59,20 @@ using namespace llvm; static cl::opt DisableColoring("no-stack-coloring", - cl::init(false), cl::Hidden, - cl::desc("Suppress stack coloring")); + cl::init(false), cl::Hidden, + cl::desc("Disable stack coloring")); -STATISTIC(NumMarkerSeen, "Number of life markers found."); +static cl::opt +CheckEscapedAllocas("stack-coloring-check-escaped", + cl::init(true), cl::Hidden, + cl::desc("Look for allocas which escaped the lifetime region")); + +STATISTIC(NumMarkerSeen, "Number of lifetime markers found."); STATISTIC(StackSpaceSaved, "Number of bytes saved due to merging slots."); STATISTIC(StackSlotMerged, "Number of stack slot merged."); +STATISTIC(EscapedAllocas, + "Number of allocas that escaped the lifetime region"); + //===----------------------------------------------------------------------===// // StackColoring Pass @@ -104,7 +112,7 @@ class StackColoring : public MachineFunctionPass { /// VNInfo is used for the construction of LiveIntervals. VNInfo::Allocator VNInfoAllocator; /// SlotIndex analysis object. - SlotIndexes* Indexes; + SlotIndexes *Indexes; /// The list of lifetime markers found. These markers are to be removed /// once the coloring is done. @@ -533,7 +541,7 @@ void StackColoring::remapInstructions(DenseMap &SlotRemap) { #ifndef NDEBUG if (!I->isDebugValue()) { SlotIndex Index = Indexes->getInstructionIndex(I); - LiveInterval* Interval = Intervals[FromSlot]; + LiveInterval *Interval = Intervals[FromSlot]; assert(Interval->find(Index) != Interval->end() && "Found instruction usage outside of live range."); } @@ -583,6 +591,7 @@ void StackColoring::removeInvalidSlotRanges() { if (Interval->find(Index) == Interval->end()) { Intervals[Slot]->clear(); DEBUG(dbgs()<<"Invalidating range #"< SlotRemap; -- cgit v1.2.3-18-g5258