[llvm] [PowerPC] $carry should be added to successors liveins if still alive after expanding ISEL (PR #127376)

Lei Huang via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 18 13:00:19 PST 2025


================
@@ -35349,22 +35350,7 @@ MVT X86TargetLowering::getPreferredSwitchConditionType(LLVMContext &Context,
 // basic block or any successors of the basic block.
 static bool isEFLAGSLiveAfter(MachineBasicBlock::iterator Itr,
                               MachineBasicBlock *BB) {
-  // Scan forward through BB for a use/def of EFLAGS.
-  for (const MachineInstr &mi : llvm::make_range(std::next(Itr), BB->end())) {
-    if (mi.readsRegister(X86::EFLAGS, /*TRI=*/nullptr))
-      return true;
-    // If we found a def, we can stop searching.
-    if (mi.definesRegister(X86::EFLAGS, /*TRI=*/nullptr))
-      return false;
-  }
-
-  // If we hit the end of the block, check whether EFLAGS is live into a
-  // successor.
-  for (MachineBasicBlock *Succ : BB->successors())
-    if (Succ->isLiveIn(X86::EFLAGS))
-      return true;
-
-  return false;
+  return isPhysRegLiveAfter(X86::EFLAGS, Itr);
----------------
lei137 wrote:

Can we just replace all references to `isEFLAGSLiveAfter()` with `isPhysRegLiveAfter(X86::EFLAGS, Itr);`?

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


More information about the llvm-commits mailing list