[llvm] [AMDGPU] Handle MachineOperandType global address in SIFoldOperands. (PR #135424)
Akhilesh Moorthy via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 11 12:17:10 PDT 2025
https://github.com/isakhilesh created https://github.com/llvm/llvm-project/pull/135424
While FoldingImmLike accepts :
MO_Immediate, MO_FrameIndex and MO_GlobalAddress.
The conditional block after it only covers the first 2. So I have added a case for the global value as well.
>From 3cc9d0728e30a6b0e626937a1fd1ac6c4d641794 Mon Sep 17 00:00:00 2001
From: Akhilesh Moorthy <akhilesh.moorthy at amd.com>
Date: Fri, 11 Apr 2025 14:01:30 -0500
Subject: [PATCH] [AMDGPU] Handle MachineOperandType global address in
SIFoldOperands.
While FoldingImmLike accepts :
MO_Immediate, MO_FrameIndex and MO_GlobalAddress.
The conditional block after it only covers the first 2.
So I have added a case for the global value as well.
---
llvm/lib/Target/AMDGPU/SIFoldOperands.cpp | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/llvm/lib/Target/AMDGPU/SIFoldOperands.cpp b/llvm/lib/Target/AMDGPU/SIFoldOperands.cpp
index d6acf9e081b9f..701d17930d7df 100644
--- a/llvm/lib/Target/AMDGPU/SIFoldOperands.cpp
+++ b/llvm/lib/Target/AMDGPU/SIFoldOperands.cpp
@@ -1161,8 +1161,10 @@ void SIFoldOperandsImpl::foldOperand(
if (OpToFold.isImm())
UseMI->getOperand(1).ChangeToImmediate(OpToFold.getImm());
- else
+ else if(OpToFold.isFI())
UseMI->getOperand(1).ChangeToFrameIndex(OpToFold.getIndex());
+ else if(OpToFold.isGlobal())
+ return;
UseMI->removeOperand(2); // Remove exec read (or src1 for readlane)
return;
}
More information about the llvm-commits
mailing list