diff --git a/llvm/lib/CodeGen/ReachingDefAnalysis.cpp b/llvm/lib/CodeGen/ReachingDefAnalysis.cpp --- a/llvm/lib/CodeGen/ReachingDefAnalysis.cpp +++ b/llvm/lib/CodeGen/ReachingDefAnalysis.cpp @@ -83,14 +83,16 @@ if (Incoming.empty()) continue; - for (unsigned Unit = 0; Unit != NumRegUnits; ++Unit) { - // Use the most recent predecessor def for each register. + // Find the most recent reaching definition from a predecessor. + for (unsigned Unit = 0; Unit != NumRegUnits; ++Unit) LiveRegs[Unit] = std::max(LiveRegs[Unit], Incoming[Unit]); - if ((LiveRegs[Unit] != ReachingDefDefaultVal)) - MBBReachingDefs[MBBNumber][Unit].push_back(LiveRegs[Unit]); - } } + // Insert the most recent reaching definition we found. + for (unsigned Unit = 0; Unit != NumRegUnits; ++Unit) + if (LiveRegs[Unit] != ReachingDefDefaultVal) + MBBReachingDefs[MBBNumber][Unit].push_back(LiveRegs[Unit]); + LLVM_DEBUG(dbgs() << printMBBReference(*MBB) << (!TraversedMBB.IsDone ? ": incomplete\n" : ": all preds known\n"));