[llvm] 9c65795 - [ReachingDefAnalysis] Detect entry block correclty. (#176803)

via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 21 08:29:12 PST 2026


Author: Mikhail Gudim
Date: 2026-01-21T08:29:08-08:00
New Revision: 9c657954f3c35a1d25c98a668a5c2fb15e12224a

URL: https://github.com/llvm/llvm-project/commit/9c657954f3c35a1d25c98a668a5c2fb15e12224a
DIFF: https://github.com/llvm/llvm-project/commit/9c657954f3c35a1d25c98a668a5c2fb15e12224a.diff

LOG: [ReachingDefAnalysis] Detect entry block correclty. (#176803)

Before a block was deemed an entry block if it did not have any
predecessors, which is wrong: entry block can be a loop header.

Added: 
    

Modified: 
    llvm/lib/CodeGen/ReachingDefAnalysis.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/ReachingDefAnalysis.cpp b/llvm/lib/CodeGen/ReachingDefAnalysis.cpp
index 160c8f43217a8..c36c86ee5a9a9 100644
--- a/llvm/lib/CodeGen/ReachingDefAnalysis.cpp
+++ b/llvm/lib/CodeGen/ReachingDefAnalysis.cpp
@@ -128,7 +128,7 @@ void ReachingDefInfo::enterBasicBlock(MachineBasicBlock *MBB) {
     LiveRegs.assign(NumRegUnits, ReachingDefDefaultVal);
 
   // This is the entry block.
-  if (MBB->pred_empty()) {
+  if (MBB == &MBB->getParent()->front()) {
     for (const auto &LI : MBB->liveins()) {
       for (MCRegUnit Unit : TRI->regunits(LI.PhysReg)) {
         // Treat function live-ins as if they were defined just before the first


        


More information about the llvm-commits mailing list