[llvm] RegisterCoalescer: Enable terminal rule by default for AMDGPU (PR #161621)

via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 18 04:54:38 PST 2025


hstk30-hw wrote:

```
diff --git a/llvm/lib/CodeGen/RegisterCoalescer.cpp b/llvm/lib/CodeGen/RegisterCoalescer.cpp
index 25c4375a73ce..e624088a0964 100644
--- a/llvm/lib/CodeGen/RegisterCoalescer.cpp
+++ b/llvm/lib/CodeGen/RegisterCoalescer.cpp
@@ -4150,7 +4150,7 @@ bool RegisterCoalescer::applyTerminalRule(const MachineInstr &Copy) const {
       continue;
     Register OtherSrcReg, OtherReg;
     unsigned OtherSrcSubReg = 0, OtherSubReg = 0;
-    if (!isMoveInstr(*TRI, &Copy, OtherSrcReg, OtherReg, OtherSrcSubReg,
+    if (!isMoveInstr(*TRI, &MI, OtherSrcReg, OtherReg, OtherSrcSubReg,
                      OtherSubReg))
       return false;
     if (OtherReg == SrcReg)
```

I review the  `RegisterCoalescer::applyTerminalRule` code, I guess there maybe a bug which is introduced by commit `6749ae36b4a33769e7a77cf812d7cd0a908ae3b9`, and has been present ever since.

Please review it again.  @qcolombet @arsenm 

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


More information about the llvm-commits mailing list