[llvm] [Hexagon][NFC] Fix duplicate A2_tfr check in HexagonGlobalScheduler (PR #227762)

Fateme Hosseini via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 6 09:59:15 PDT 2026


https://github.com/fhossein-quic updated https://github.com/llvm/llvm-project/pull/227762

>From 3ef49809476e984e56301476db6957892713f6c2 Mon Sep 17 00:00:00 2001
From: Fateme Hosseini <fhossein at qti.qualcomm.com>
Date: Wed, 30 Sep 2026 08:41:04 -0700
Subject: [PATCH] [Hexagon] Fix duplicate A2_tfr check in pullUpPeelBBLoop

The condition checked the same opcode twice:
  TfrOpcode != Hexagon::A2_tfr && TfrOpcode != Hexagon::A2_tfr

The second operand was likely intended to be A2_tfrsi, but A2_tfrsi
can never succeed through this path (operand(1) is an immediate, not
a register, so the subsequent isReg() check rejects it). Simplify to
a single A2_tfr check and remove the unused TfrOpcode variable.

Add a MIR test exercising pullUpPeelBBLoop, which previously had no
test coverage.

Fixes #227412

Change-Id: Idc7ca5d04b9d076ecd6738c009c34b94f9bae4c5
---
 llvm/lib/Target/Hexagon/HexagonGlobalScheduler.cpp | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/llvm/lib/Target/Hexagon/HexagonGlobalScheduler.cpp b/llvm/lib/Target/Hexagon/HexagonGlobalScheduler.cpp
index 452ef6a5facbfd..c66a77a8b6f54f 100644
--- a/llvm/lib/Target/Hexagon/HexagonGlobalScheduler.cpp
+++ b/llvm/lib/Target/Hexagon/HexagonGlobalScheduler.cpp
@@ -4160,8 +4160,7 @@ bool HexagonGlobalSchedulerImpl::pullUpPeelBBLoop(MachineBasicBlock *PredBB,
   MachineInstr *RegMI = &*FMI;
   if (RegMI->isBundle())
     return false;
-  int TfrOpcode = RegMI->getOpcode();
-  if (TfrOpcode != Hexagon::A2_tfr && TfrOpcode != Hexagon::A2_tfr)
+  if (RegMI->getOpcode() != Hexagon::A2_tfr)
     return false;
   if (!(RegMI->getOperand(0).isReg() && RegMI->getOperand(1).isReg()))
     return false;



More information about the llvm-commits mailing list