diff options
author | Alon Zakai <alonzakai@gmail.com> | 2014-03-08 17:02:38 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2014-03-08 17:02:38 -0800 |
commit | 3b5ab8f9039635fda547290fda398c1cd350423a (patch) | |
tree | 6c05e277bceef11121a50bc367752086f0ccd6b0 | |
parent | 06b7ce14ded3d39a8e4703d22b360fa782c1522a (diff) |
avoid infinite loops in AllocaManager::computeInterBlockLiveness
-rw-r--r-- | lib/Target/JSBackend/AllocaManager.cpp | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/lib/Target/JSBackend/AllocaManager.cpp b/lib/Target/JSBackend/AllocaManager.cpp index 4673a34644..b49e6c4de1 100644 --- a/lib/Target/JSBackend/AllocaManager.cpp +++ b/lib/Target/JSBackend/AllocaManager.cpp @@ -249,11 +249,15 @@ void AllocaManager::computeInterBlockLiveness() { // If it contains new live blocks, prepare to propagate them. if (Temp.test(BLI.LiveIn)) { BLI.LiveIn |= Temp; + BitVector LiveOut = BLI.LiveOut; BLI.LiveOut |= Temp; BLI.LiveOut.reset(BLI.End); - for (succ_const_iterator SI = succ_begin(BB), SE = succ_end(BB); - SI != SE; ++SI) { - InterBlockWorklist.insert(*SI); + // If we actually added to live-out, re-process them + if (BLI.LiveOut.test(LiveOut)) { + for (succ_const_iterator SI = succ_begin(BB), SE = succ_end(BB); + SI != SE; ++SI) { + InterBlockWorklist.insert(*SI); + } } } Temp.reset(); @@ -268,11 +272,15 @@ void AllocaManager::computeInterBlockLiveness() { if (Temp.test(BLI.LiveOut)) { // TODO: As above, what are the semantics of a standalone lifetime end? BLI.LiveOut |= Temp; + BitVector LiveIn = BLI.LiveIn; BLI.LiveIn |= Temp; BLI.LiveIn.reset(BLI.Start); - for (const_pred_iterator PI = pred_begin(BB), PE = pred_end(BB); - PI != PE; ++PI) { - InterBlockWorklist.insert(*PI); + // If we actually added to live-in, re-process them + if (BLI.LiveIn.test(LiveIn)) { + for (const_pred_iterator PI = pred_begin(BB), PE = pred_end(BB); + PI != PE; ++PI) { + InterBlockWorklist.insert(*PI); + } } } Temp.reset(); @@ -453,7 +461,6 @@ AllocaManager::AllocaManager() { void AllocaManager::analyze(const Function &Func, const DataLayout &Layout, bool PerformColoring) { NamedRegionTimer Timer("AllocaManager", TimePassesIsEnabled); - assert(Allocas.empty()); assert(AllocasByIndex.empty()); assert(AllocaCompatibility.empty()); |