[llvm-branch-commits] [llvm] [CodeGen] Enhance createFrom for sub-reg aware cloning (PR #174999)

Christudasan Devadasan via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Mon Jan 12 02:15:26 PST 2026


================
@@ -154,8 +154,11 @@ class LiveRangeEdit : private MachineRegisterInfo::Delegate {
 
   ArrayRef<Register> regs() const { return ArrayRef(NewRegs).slice(FirstNew); }
 
-  /// createFrom - Create a new virtual register based on OldReg.
-  Register createFrom(Register OldReg);
+  /// createFrom - Create a new virtual register based on OldReg. If \p RC is
+  /// non-null, constrain the register class of the new vreg. Partial reloads
+  /// of tuple regclasses will feed-in a subregclass derived from the regclass
+  /// of OldReg.
+  Register createFrom(Register OldReg, const TargetRegisterClass *RC = nullptr);
----------------
cdevadas wrote:

Yes I can try that. But at the moment, the call to `getConstrainedRegClass` at its caller (InlineSpiller.cpp in the other patch  https://github.com/llvm/llvm-project/pull/175002) makes it difficult. For now, I'm leaving it untouched, and I will get back to it later.

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


More information about the llvm-branch-commits mailing list