[OpenCL][NFCI] Prefer CodeGenFunction::EmitRuntimeCall
authorLuke Drummond <luke.drummond@codeplay.com>
Tue, 16 Mar 2021 13:28:06 +0000 (13:28 +0000)
committerLuke Drummond <luke.drummond@codeplay.com>
Tue, 16 Mar 2021 16:22:19 +0000 (16:22 +0000)
`CodeGenFunction::EmitRuntimeCall` automatically sets the right calling
convention for the callee so we can avoid setting it ourselves.

As requested in https://reviews.llvm.org/D98411

Reviewed by: anastasia
Differential Revision: https://reviews.llvm.org/D98705

clang/lib/CodeGen/CodeGenModule.cpp

index 75854f6..f3a73f8 100644 (file)
@@ -6265,9 +6265,8 @@ CodeGenModule::createOpenCLIntToSamplerConversion(const Expr *E,
   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;
 }