[clang] 440f6bd - [OpenCL][NFCI] Prefer CodeGenFunction::EmitRuntimeCall

Luke Drummond via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 16 09:23:01 PDT 2021


Author: Luke Drummond
Date: 2021-03-16T16:22:19Z
New Revision: 440f6bdf34f4ce3ac3435d650f5296dcc0102488

URL: https://github.com/llvm/llvm-project/commit/440f6bdf34f4ce3ac3435d650f5296dcc0102488
DIFF: https://github.com/llvm/llvm-project/commit/440f6bdf34f4ce3ac3435d650f5296dcc0102488.diff

LOG: [OpenCL][NFCI] Prefer CodeGenFunction::EmitRuntimeCall

`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

Added: 
    

Modified: 
    clang/lib/CodeGen/CodeGenModule.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp
index 75854f69b110..f3a73f8783dc 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/lib/CodeGen/CodeGenModule.cpp
@@ -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;
 }
 


        


More information about the cfe-commits mailing list