[llvm] [TwoAddressInstruction] Track MadeChange when eliminating REG_SEQUENCE (PR #173535)

Teja Alaghari via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 25 01:25:01 PST 2025


https://github.com/TejaX-Alaghari created https://github.com/llvm/llvm-project/pull/173535

When `eliminateRegSequence()` is called, the pass modifies the `MachineFunction` but `MadeChange` was not being set to true. 
This causes the pass to incorrectly return `PreservedAnalyses::all()` even though changes were made.

>From 2057b7d2fd55165ced010e773914f58733bfa803 Mon Sep 17 00:00:00 2001
From: Teja Alaghari <teja.alaghari at amd.com>
Date: Thu, 25 Dec 2025 14:38:52 +0530
Subject: [PATCH] Track MadeChange when eliminating REG_SEQUENCE

---
 llvm/lib/CodeGen/TwoAddressInstructionPass.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/llvm/lib/CodeGen/TwoAddressInstructionPass.cpp b/llvm/lib/CodeGen/TwoAddressInstructionPass.cpp
index c306fe6012c11..e687369f8a27c 100644
--- a/llvm/lib/CodeGen/TwoAddressInstructionPass.cpp
+++ b/llvm/lib/CodeGen/TwoAddressInstructionPass.cpp
@@ -1878,8 +1878,10 @@ bool TwoAddressInstructionImpl::run() {
 
       // Expand REG_SEQUENCE instructions. This will position mi at the first
       // expanded instruction.
-      if (mi->isRegSequence())
+      if (mi->isRegSequence()) {
         eliminateRegSequence(mi);
+        MadeChange = true;
+      }
 
       DistanceMap.insert(std::make_pair(&*mi, ++Dist));
 



More information about the llvm-commits mailing list