[RDA] Don't adjust ReachingDefDefaultVal (NFCI)
authorNikita Popov <nikita.ppv@gmail.com>
Sun, 5 Apr 2020 17:16:56 +0000 (19:16 +0200)
committerNikita Popov <nikita.ppv@gmail.com>
Mon, 6 Apr 2020 16:36:29 +0000 (18:36 +0200)
At the end of a basic block, RDA adjusts all the reaching defs it
found to be relative to the end of the basic block, rather than the
start of it. However, it also does this to registers which don't
have a reaching def, indicated by ReachingDefDefaultVal. This means
that code checking against ReachingDefDefaultVal will not skip them,
and may insert them into the reaching definition list. This is
ultimately harmless, but causes unnecessary work and is logically
not right.

Differential Revision: https://reviews.llvm.org/D77506

llvm/lib/CodeGen/ReachingDefAnalysis.cpp

index 6029250..8695297 100644 (file)
@@ -110,7 +110,8 @@ void ReachingDefAnalysis::leaveBasicBlock(
   // only cares about the clearance from the end of the block, so adjust
   // everything to be relative to the end of the basic block.
   for (int &OutLiveReg : MBBOutRegsInfos[MBBNumber])
-    OutLiveReg -= CurInstr;
+    if (OutLiveReg != ReachingDefDefaultVal)
+      OutLiveReg -= CurInstr;
   LiveRegs.clear();
 }