[llvm] [AArch64] Clean-up constrain register check in selectCopy (NFC) (PR #197168)

Igor Wodiany via llvm-commits llvm-commits at lists.llvm.org
Tue May 12 05:14:11 PDT 2026


https://github.com/IgWod created https://github.com/llvm/llvm-project/pull/197168

This addresses post-commit review from #188781.

>From 769fdd4bc601e294d213b82e2560f13a3b3d0792 Mon Sep 17 00:00:00 2001
From: Igor Wodiany <igor.wodiany at amd.com>
Date: Tue, 12 May 2026 13:07:51 +0100
Subject: [PATCH] [AArch64] Clean-up constrain register check in selectCopy
 (NFC)

This addresses post-commit review from #188781.
---
 .../Target/AArch64/GISel/AArch64InstructionSelector.cpp    | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/llvm/lib/Target/AArch64/GISel/AArch64InstructionSelector.cpp b/llvm/lib/Target/AArch64/GISel/AArch64InstructionSelector.cpp
index 5d2b4bc7ac6d3..cf650fd5c4e72 100644
--- a/llvm/lib/Target/AArch64/GISel/AArch64InstructionSelector.cpp
+++ b/llvm/lib/Target/AArch64/GISel/AArch64InstructionSelector.cpp
@@ -1056,11 +1056,8 @@ static bool selectCopy(MachineInstr &I, const TargetInstrInfo &TII,
     unsigned SrcSubReg = I.getOperand(1).getSubReg();
     unsigned SubReg;
 
-    if (SrcSubReg) {
-      if (!RBI.constrainGenericRegister(DstReg, *DstRC, MRI))
-        return false;
-      return true;
-    }
+    if (SrcSubReg)
+      return RBI.constrainGenericRegister(DstReg, *DstRC, MRI);
 
     // If the source bank doesn't support a subregister copy small enough,
     // then we first need to copy to the destination bank.



More information about the llvm-commits mailing list