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

via llvm-commits llvm-commits at lists.llvm.org
Tue May 12 05:15:00 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-backend-aarch64

Author: Igor Wodiany (IgWod)

<details>
<summary>Changes</summary>

This addresses post-commit review from #<!-- -->188781.

---
Full diff: https://github.com/llvm/llvm-project/pull/197168.diff


1 Files Affected:

- (modified) llvm/lib/Target/AArch64/GISel/AArch64InstructionSelector.cpp (+2-5) 


``````````diff
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.

``````````

</details>


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


More information about the llvm-commits mailing list