[PATCH] D98705: [OpenCL] Prefer CodeGenFunction::EmitRuntimeCall

Luke Drummond via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 16 06:34:34 PDT 2021


ldrumm created this revision.
ldrumm added reviewers: Anastasia, bader.
ldrumm added a project: clang.
Herald added a subscriber: yaxunl.
ldrumm requested review of this revision.
Herald added a subscriber: cfe-commits.

CodeGenFunction::EmitRuntimeCall automatically sets the right calling      │
convention for the callee so we can avoid setting it ourselves


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D98705

Files:
  clang/lib/CodeGen/CodeGenModule.cpp


Index: clang/lib/CodeGen/CodeGenModule.cpp
===================================================================
--- clang/lib/CodeGen/CodeGenModule.cpp
+++ clang/lib/CodeGen/CodeGenModule.cpp
@@ -6265,9 +6265,8 @@
   llvm::Constant *C = ConstantEmitter(CGF).emitAbstract(E, E->getType());
   auto *SamplerT = getOpenCLRuntime().getSamplerType(E->getType().getTypePtr());
   auto *FTy = llvm::FunctionType::get(SamplerT, {C->getType()}, false);
-  auto *Call = CGF.Builder.CreateCall(
+  auto *Call = CGF.EmitRuntimeCall(
       CreateRuntimeFunction(FTy, "__translate_sampler_initializer"), {C});
-  Call->setCallingConv(Call->getCalledFunction()->getCallingConv());
   return Call;
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D98705.330965.patch
Type: text/x-patch
Size: 687 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210316/009735ad/attachment.bin>


More information about the cfe-commits mailing list