[llvm] Reland "RegisterCoalescer: Add implicit-def of super register when coalescing SUBREG_TO_REG" (PR #168353)

Benjamin Maxwell via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 17 07:56:35 PST 2025


================
@@ -2046,6 +2138,30 @@ void RegisterCoalescer::setUndefOnPrunedSubRegUses(LiveInterval &LI,
   LIS->shrinkToUses(&LI);
 }
 
+/// For a given use of value \p Idx, it returns the def in the current block,
+/// or otherwise all possible defs in preceding blocks.
+static bool FindDefInBlock(SmallPtrSetImpl<MachineBasicBlock *> &VisitedBlocks,
----------------
MacDue wrote:

```suggestion
static bool findDefInBlock(SmallPtrSetImpl<MachineBasicBlock *> &VisitedBlocks,
```
also, nit: I think `FindDefInBlock` makes it sound like it's looking for a def always in a particular block. 
Maybe `findPrecedingDefs`?

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


More information about the llvm-commits mailing list