[llvm] [MCP] Avoid Folding Spill Chains Over Across Source Clobbers (PR #207169)

Jack Styles via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 6 01:39:03 PDT 2026


================
@@ -0,0 +1,33 @@
+# RUN: llc -mtriple=aarch64 -run-pass=machine-cp -enable-spill-copy-elim -verify-machineinstrs -o - %s | FileCheck %s
+# When running MachineCopyPropagation, we need to make sure COPY's do not get removed
+# when calls outside of the chain clobber a source included in the chain.
+# See: https://github.com/llvm/llvm-project/issues/206839
----------------
Stylie777 wrote:

The Register Allocator can generate a long chain of COPY's in instances where spill/reloads occur. These are impactful for performance so this pass works to simplify these chains. Usually, they are just moving values from register to register (See the example in https://github.com/llvm/llvm-project/pull/186093's description).

There was a bug however where, if a register was used in a COPY outside of the chain and clobbered, this could be missed and the original value lost of the register in the chain. So this aims to ensure the original value is copied out, and back in again in the chain.

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


More information about the llvm-commits mailing list