[PATCH] D36831: [AMDGPU] Transform __read_pipe_* and __write_pipe_*

Stanislav Mekhanoshin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 17 10:26:09 PDT 2017


rampitec requested changes to this revision.
rampitec added a comment.
This revision now requires changes to proceed.

Please use AMDGPULibFunc instead of manual function name manipulations.



================
Comment at: lib/Target/AMDGPU/AMDGPULibCalls.cpp:598
+  unsigned PtrArgAS = PtrArg->getType()->getPointerAddressSpace();
+  auto *PtrTy = llvm::PointerType::get(PtrElemTy, PtrArgAS);
+
----------------
"llvm::" prefix is not needed.


================
Comment at: lib/Target/AMDGPU/AMDGPULibCalls.cpp:616
+
+  auto *F = M->getOrInsertFunction(Name, FTy);
+  auto *NCI = B.CreateCall(F, Args);
----------------
You should not use getOrInsertFunction directly, but use AMDGPULibCalls::getFunction().
Since you are not using it you also fail to check we are in pre-link.


================
Comment at: lib/Target/AMDGPU/AMDGPULibCalls.cpp:645
+  auto Name = Callee->getName();
+  if (Name.startswith("__read_pipe_") || Name.startswith("__write_pipe_"))
+    return fold_read_write_pipe(CI, B);
----------------
You should use AMDGPULibFunc and parser/mangler used across the whole this source.


https://reviews.llvm.org/D36831





More information about the llvm-commits mailing list