[llvm] [NVPTX] Improve copy avoidance during lowering. (PR #106423)

Fei Peng via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 28 16:20:57 PDT 2024


================
@@ -269,24 +293,44 @@ static void convertToParamAS(Use *OldUse, Value *Param, bool GridConstant) {
                              OriginalUser->getIterator());
         return CvtToGenCall;
       };
-
-      if (auto *CI = dyn_cast<CallInst>(I.OldInstruction)) {
-        I.OldUse->set(GetParamAddrCastToGeneric(I.NewParam, CI));
-        return CI;
+      auto *ParamInGenericAS =
+          GetParamAddrCastToGeneric(I.NewParam, I.OldInstruction);
+
+      // phi/select could use generic arg pointers w/o __grid_constant__
----------------
fiigii wrote:

Although we always prefer non-generic loads/store, selecting different addr space pointers from phi/select are rare cases. The current implementation should be okay. Just pointed out a potential issue that you may see in the future. 

https://github.com/llvm/llvm-project/pull/106423


More information about the llvm-commits mailing list