[llvm] 8d75df1 - [RDA] Don't adjust ReachingDefDefaultVal (NFCI)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 6 09:36:44 PDT 2020


Author: Nikita Popov
Date: 2020-04-06T18:36:29+02:00
New Revision: 8d75df14389bddc4a546cf059d223e730539bc53

URL: https://github.com/llvm/llvm-project/commit/8d75df14389bddc4a546cf059d223e730539bc53
DIFF: https://github.com/llvm/llvm-project/commit/8d75df14389bddc4a546cf059d223e730539bc53.diff

LOG: [RDA] Don't adjust ReachingDefDefaultVal (NFCI)

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

Added: 
    

Modified: 
    llvm/lib/CodeGen/ReachingDefAnalysis.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/ReachingDefAnalysis.cpp b/llvm/lib/CodeGen/ReachingDefAnalysis.cpp
index 60292503af17..869529724b11 100644
--- a/llvm/lib/CodeGen/ReachingDefAnalysis.cpp
+++ b/llvm/lib/CodeGen/ReachingDefAnalysis.cpp
@@ -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();
 }
 


        


More information about the llvm-commits mailing list