[llvm] AMDGPU: Fix mfma scale source legalization (PR #117238)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 21 13:00:10 PST 2024


https://github.com/arsenm updated https://github.com/llvm/llvm-project/pull/117238

>From 7565159f2ee9e27bec59b34a7b7f9ae8adefd0b8 Mon Sep 17 00:00:00 2001
From: Stanislav Mekhanoshin <Stanislav.Mekhanoshin at amd.com>
Date: Fri, 1 Mar 2024 16:01:11 -0800
Subject: [PATCH] AMDGPU: Fix mfma scale source legalization

Code inside assert changes the variable instead of the comparison.
---
 llvm/lib/Target/AMDGPU/SIISelLowering.cpp | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/llvm/lib/Target/AMDGPU/SIISelLowering.cpp b/llvm/lib/Target/AMDGPU/SIISelLowering.cpp
index 1406938592b2cb..e520dfff1016b2 100644
--- a/llvm/lib/Target/AMDGPU/SIISelLowering.cpp
+++ b/llvm/lib/Target/AMDGPU/SIISelLowering.cpp
@@ -15462,9 +15462,8 @@ void SITargetLowering::AdjustInstrPostInstrSelection(MachineInstr &MI,
         int Src0Idx = AMDGPU::getNamedOperandIdx(MI.getOpcode(),
                                                  AMDGPU::OpName::scale_src0);
         if (Src0Idx != -1) {
-          int Src1Idx = Src0Idx + 2;
-          assert(Src1Idx = AMDGPU::getNamedOperandIdx(
-                     MI.getOpcode(), AMDGPU::OpName::scale_src1));
+          int Src1Idx = AMDGPU::getNamedOperandIdx(MI.getOpcode(),
+                                                   AMDGPU::OpName::scale_src1);
           if (TII->usesConstantBus(MRI, MI, Src0Idx) &&
               TII->usesConstantBus(MRI, MI, Src1Idx))
             TII->legalizeOpWithMove(MI, Src1Idx);



More information about the llvm-commits mailing list