[PATCH] D149938: [AMDGPU][InferAddressSpaces] Only rewrite address-spaces that can be trivially casted to flat for llvm.amdgcn.flat.atomic.{fadd,fmax,fmin}

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 9 08:25:21 PDT 2023


arsenm added inline comments.


================
Comment at: llvm/lib/Target/AMDGPU/AMDGPUTargetTransformInfo.cpp:1088-1089
+        static_cast<const GCNTargetMachine &>(getTLI()->getTargetMachine());
+    if (!TM.isNoopAddrSpaceCast(OldAS, NewAS))
+      return nullptr;
     Module *M = II->getParent()->getParent()->getParent();
----------------
But the not-noop address space casts are the cases we're interested in handling. Do you mean to check for valid casts?


================
Comment at: llvm/test/Transforms/InferAddressSpaces/AMDGPU/flat-fadd-fmin-fmax-intrinsics.ll:4
+
+declare float @llvm.amdgcn.flat.atomic.fadd.f32.p0.f32(ptr %ptr, float %data)
+declare float @llvm.amdgcn.flat.atomic.fmax.f32.p0.f32(ptr %ptr, float %data)
----------------
Can you precommit the test to show the diff?


================
Comment at: llvm/test/Transforms/InferAddressSpaces/AMDGPU/flat-fadd-fmin-fmax-intrinsics.ll:166
+  ret void
+}
----------------
Add a test with a random number, other unknown address spaces should generally act like global.

Also test the new fat pointer address spaces?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D149938/new/

https://reviews.llvm.org/D149938



More information about the llvm-commits mailing list