[llvm] PeepholeOpt: Block subregister sources for REG_SEQUENCE copy coalescing (PR #194628)

Frederik Harwath via llvm-commits llvm-commits at lists.llvm.org
Wed May 6 03:48:22 PDT 2026


================
@@ -1250,8 +1257,12 @@ bool PeepholeOptimizer::optimizeCoalescableCopy(MachineInstr &MI) {
     return optimizeCoalescableCopyImpl(InsertSubregRewriter(MI));
   case TargetOpcode::EXTRACT_SUBREG:
     return optimizeCoalescableCopyImpl(ExtractSubregRewriter(MI, *TII));
-  case TargetOpcode::REG_SEQUENCE:
-    return optimizeCoalescableCopyImpl(RegSequenceRewriter(MI));
+  case TargetOpcode::REG_SEQUENCE: {
+    // Subreg sources can increase register pressure by keeping
+    // multiple wide registers alive.
+    bool AcceptSubReg = false;
+    return optimizeCoalescableCopyImpl(RegSequenceRewriter(MI), AcceptSubReg);
+  }
----------------
frederik-h wrote:

Yes, it is, just in a different place! I guess we would need to recognize the problematic patterns and prevent the rewrite just in those cases.

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


More information about the llvm-commits mailing list