[llvm] [AMDGPU] Fix image intrinsic optimizer on loads from different resources (PR #69355)
Carl Ritson via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 17 17:45:37 PDT 2023
================
@@ -108,28 +108,29 @@ void addInstToMergeableList(
if (IIList.front()->getType() != II->getType())
continue;
- // Check DMask.
- Value *DMaskList = IIList.front()->getArgOperand(ImageDimIntr->DMaskIndex);
- Value *DMask = II->getArgOperand(ImageDimIntr->DMaskIndex);
- if (DMaskList != DMask)
- continue;
-
- // Check VAddr (except FragId).
- int I = ImageDimIntr->VAddrStart;
- for (; I < ImageDimIntr->VAddrEnd - 1; ++I) {
- if (IIList.front()->getArgOperand(I) != II->getArgOperand(I))
- break;
+ // Check all arguments (DMask, VAddr, RSrc etc).
+ bool AllEqual = true;
+ assert(IIList.front()->arg_size() == II->arg_size());
+ for (int I = 1, E = II->arg_size(); I != E; ++I) {
----------------
perlfu wrote:
This is just stylistic, so feel free to ignore me, but if `AllEqual` was part of the for-loop precondition, then you could just assign it comparison results in the loop and remove the `if (...) {AllEqual = true; break}` patterns.
https://github.com/llvm/llvm-project/pull/69355
More information about the llvm-commits
mailing list