[llvm] [GISel][AArch64] Reuse LHS and RHS in emitFPCompare instead of calling getReg a second time (NFC) (PR #178457)

via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 28 08:17:23 PST 2026


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-backend-aarch64

Author: None (SiliconA-Z)

<details>
<summary>Changes</summary>

Instead of calling getReg again, we use the previous result, which is what we have.

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


1 Files Affected:

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


``````````diff
diff --git a/llvm/lib/Target/AArch64/GISel/AArch64InstructionSelector.cpp b/llvm/lib/Target/AArch64/GISel/AArch64InstructionSelector.cpp
index 7605bbea51f56..c99b9e745174b 100644
--- a/llvm/lib/Target/AArch64/GISel/AArch64InstructionSelector.cpp
+++ b/llvm/lib/Target/AArch64/GISel/AArch64InstructionSelector.cpp
@@ -4881,9 +4881,8 @@ MachineInstr *AArch64InstructionSelector::emitConjunctionRec(
     // Produce a normal comparison if we are first in the chain
     if (!CCOp) {
       if (isa<GICmp>(Cmp))
-        return emitCMP(Cmp->getOperand(2), Cmp->getOperand(3), MIB);
-      return emitFPCompare(Cmp->getOperand(2).getReg(),
-                           Cmp->getOperand(3).getReg(), MIB);
+        return emitSUBS(Dst, Cmp->getOperand(2), Cmp->getOperand(3), MIB);
+      return emitFPCompare(LHS, RHS, MIB, CC);
     }
     // Otherwise produce a ccmp.
     return emitConditionalComparison(LHS, RHS, CC, Predicate, OutCC, MIB);

``````````

</details>


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


More information about the llvm-commits mailing list