[llvm] [AArch64] Fix copy and paste error in tryCombineMULLWithUZP1() (NFCI) (PR #97729)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 4 06:33:04 PDT 2024


https://github.com/nikic created https://github.com/llvm/llvm-project/pull/97729

The bitcast check was performed on the wrong value in one of the branches.

I believe this doesn't actually result in any behavior difference, because the following code looking at ExtractHigh users currently doesn't try to look through BITCASTS. I've left a TODO for that.

Fixes https://github.com/llvm/llvm-project/issues/94761.

>From a8edec57ea5160ff58b909892371ee1f16cb575f Mon Sep 17 00:00:00 2001
From: Nikita Popov <npopov at redhat.com>
Date: Thu, 4 Jul 2024 15:22:56 +0200
Subject: [PATCH] [AArch64] Fix copy and paste error in
 tryCombineMULLWithUZP1()

The bitcast check was performed on the wrong value in one of the
branches.

I believe this doesn't actually result in any behavior difference,
because the following code looking at ExtractHigh users doesn't
try to look through BITCASTS. I've left a TODO for that.

Fixes https://github.com/llvm/llvm-project/issues/94761.
---
 llvm/lib/Target/AArch64/AArch64ISelLowering.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
index e0c3cc5eddb82..760ae32d1059a 100644
--- a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
+++ b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
@@ -24829,7 +24829,7 @@ static SDValue tryCombineMULLWithUZP1(SDNode *N,
   } else if (isEssentiallyExtractHighSubvector(RHS) &&
              LHS.getOpcode() == ISD::TRUNCATE) {
     TruncHigh = LHS;
-    if (LHS.getOpcode() == ISD::BITCAST)
+    if (RHS.getOpcode() == ISD::BITCAST)
       ExtractHigh = RHS.getOperand(0);
     else
       ExtractHigh = RHS;
@@ -24858,6 +24858,7 @@ static SDValue tryCombineMULLWithUZP1(SDNode *N,
   // This dagcombine assumes the two extract_high uses same source vector in
   // order to detect the pair of the mull. If they have different source vector,
   // this code will not work.
+  // TODO: Should also try to look through a bitcast.
   bool HasFoundMULLow = true;
   SDValue ExtractHighSrcVec = ExtractHigh.getOperand(0);
   if (ExtractHighSrcVec->use_size() != 2)



More information about the llvm-commits mailing list