[llvm] [EarlyIfConversion] Extend data dependent analysis across multiple blocks (PR #180623)

Nathan Corbyn via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 23 01:57:44 PDT 2026


================
@@ -923,15 +932,62 @@ static bool isConstantPoolLoad(const MachineInstr *MI) {
          });
 }
 
-/// Check if there are any calls in the range (From, To].
-static bool callInRange(const MachineInstr *From, const MachineInstr *To) {
-  constexpr int MaxInstructionsToCheck = 64;
-  int Count = 0;
-  auto InstrRange =
-      make_range(std::next(From->getIterator()), To->getIterator());
-  return any_of(InstrRange, [&](const MachineInstr &MI) {
-    return ++Count > MaxInstructionsToCheck || MI.isCall();
-  });
+/// Check if there are any calls in the path from From to To, potentially
----------------
cofibrant wrote:

This comment is a bit confusing. When I first read it I thought there was a typo and you meant 'a path' rather than 'the path'. After reading the subsequent diff, it looks like we are only considering one path in a particular call, but it's implicitly encoded via the `IntermediateBlocks` parameter and not accurately (`VisitedBlocks` grows monotonically AFAICS). `callInRange` was maybe a better name...

https://github.com/llvm/llvm-project/pull/180623


More information about the llvm-commits mailing list