diff options
author | Sanjoy Das <sanjoy@playingwithpointers.com> | 2016-06-26 04:55:26 +0000 |
---|---|---|
committer | Sanjoy Das <sanjoy@playingwithpointers.com> | 2016-06-26 04:55:26 +0000 |
commit | b2df57af65c98f7d416a30d94b8d1873626f49c8 (patch) | |
tree | 509baa28634825029070973da4154787125903f0 /llvm/lib/Transforms | |
parent | 255532f6297f47bbb432318ec684ba93a8bd8b71 (diff) | |
download | bcm5719-llvm-b2df57af65c98f7d416a30d94b8d1873626f49c8.tar.gz bcm5719-llvm-b2df57af65c98f7d416a30d94b8d1873626f49c8.zip |
[RSForGC] Bring computeLiveInValues up to code; NFC
llvm-svn: 273797
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r-- | llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp | 27 |
1 files changed, 8 insertions, 19 deletions
diff --git a/llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp b/llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp index 501aad73214..f7aa7723af6 100644 --- a/llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp +++ b/llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp @@ -2462,17 +2462,7 @@ static void checkBasicSSA(DominatorTree &DT, GCPtrLivenessData &Data, static void computeLiveInValues(DominatorTree &DT, Function &F, GCPtrLivenessData &Data) { - SmallSetVector<BasicBlock *, 32> Worklist; - auto AddPredsToWorklist = [&](BasicBlock *BB) { - // We use a SetVector so that we don't have duplicates in the worklist. - Worklist.insert(pred_begin(BB), pred_end(BB)); - }; - auto NextItem = [&]() { - BasicBlock *BB = Worklist.back(); - Worklist.pop_back(); - return BB; - }; // Seed the liveness for each individual block for (BasicBlock &BB : F) { @@ -2491,15 +2481,15 @@ static void computeLiveInValues(DominatorTree &DT, Function &F, Data.LiveIn[&BB].set_union(Data.LiveOut[&BB]); Data.LiveIn[&BB].set_subtract(Data.KillSet[&BB]); if (!Data.LiveIn[&BB].empty()) - AddPredsToWorklist(&BB); + Worklist.insert(pred_begin(&BB), pred_end(&BB)); } // Propagate that liveness until stable while (!Worklist.empty()) { - BasicBlock *BB = NextItem(); + BasicBlock *BB = Worklist.pop_back_val(); - // Compute our new liveout set, then exit early if it hasn't changed - // despite the contribution of our successor. + // Compute our new liveout set, then exit early if it hasn't changed despite + // the contribution of our successor. SetVector<Value *> LiveOut = Data.LiveOut[BB]; const auto OldLiveOutSize = LiveOut.size(); for (BasicBlock *Succ : successors(BB)) { @@ -2509,7 +2499,7 @@ static void computeLiveInValues(DominatorTree &DT, Function &F, // assert OutLiveOut is a subset of LiveOut if (OldLiveOutSize == LiveOut.size()) { // If the sets are the same size, then we didn't actually add anything - // when unioning our successors LiveIn Thus, the LiveIn of this block + // when unioning our successors LiveIn. Thus, the LiveIn of this block // hasn't changed. continue; } @@ -2525,16 +2515,15 @@ static void computeLiveInValues(DominatorTree &DT, Function &F, // assert: OldLiveIn is a subset of LiveTmp if (OldLiveIn.size() != LiveTmp.size()) { Data.LiveIn[BB] = LiveTmp; - AddPredsToWorklist(BB); + Worklist.insert(pred_begin(BB), pred_end(BB)); } - } // while( !worklist.empty() ) + } // while (!Worklist.empty()) #ifndef NDEBUG // Sanity check our output against SSA properties. This helps catch any // missing kills during the above iteration. - for (BasicBlock &BB : F) { + for (BasicBlock &BB : F) checkBasicSSA(DT, Data, BB); - } #endif } |