[PATCH] D36831: [AMDGPU] Transform __read_pipe_* and __write_pipe_*
Yaxun Liu via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Aug 20 14:40:33 PDT 2017
yaxunl marked 3 inline comments as done.
yaxunl added inline comments.
================
Comment at: lib/Target/AMDGPU/AMDGPULibCalls.cpp:598
+ unsigned PtrArgAS = PtrArg->getType()->getPointerAddressSpace();
+ auto *PtrTy = llvm::PointerType::get(PtrElemTy, PtrArgAS);
+
----------------
rampitec wrote:
> "llvm::" prefix is not needed.
will remove
================
Comment at: lib/Target/AMDGPU/AMDGPULibCalls.cpp:616
+
+ auto *F = M->getOrInsertFunction(Name, FTy);
+ auto *NCI = B.CreateCall(F, Args);
----------------
rampitec wrote:
> 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.
whether in pre-link can be checked by whether the function is declaration.
`__read_pipe_*` and `__write_pipe_*` are unmangled functions. AMDGPULibFunc::getFunction relies on argument information encoded in mangled function names, which does not work for unmangled functions.
================
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);
----------------
rampitec wrote:
> You should use AMDGPULibFunc and parser/mangler used across the whole this source.
will refactor this.
https://reviews.llvm.org/D36831
More information about the llvm-commits
mailing list