[llvm] AMDGPU: Fix mfma scale source legalization (PR #117238)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 21 12:59:47 PST 2024
https://github.com/arsenm created https://github.com/llvm/llvm-project/pull/117238
Code inside assert changes the variable instead of the comparison.
Change-Id: I6054f152b551af80499f8a4597ac462f7bb0d383
>From c806c3c0c4106035e21dd8443fc98c191e28f94c 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.
Change-Id: I6054f152b551af80499f8a4597ac462f7bb0d383
---
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