[clang] 5a09ce9 - [OpenCL] Replace a CreatePointerCast call; NFC (#112676)

via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 18 00:10:09 PDT 2024


Author: Sven van Haastregt
Date: 2024-10-18T09:10:05+02:00
New Revision: 5a09ce9e038ed73ea60edf5463dd6509f7c4848f

URL: https://github.com/llvm/llvm-project/commit/5a09ce9e038ed73ea60edf5463dd6509f7c4848f
DIFF: https://github.com/llvm/llvm-project/commit/5a09ce9e038ed73ea60edf5463dd6509f7c4848f.diff

LOG: [OpenCL] Replace a CreatePointerCast call; NFC (#112676)

With opaque pointers, the only purpose of the cast here is to cast
between address spaces, similar to the 4-argument case below.

Added: 
    

Modified: 
    clang/lib/CodeGen/CGBuiltin.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp
index a048a566a09256..28f28c70b5ae52 100644
--- a/clang/lib/CodeGen/CGBuiltin.cpp
+++ b/clang/lib/CodeGen/CGBuiltin.cpp
@@ -5636,10 +5636,10 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID,
       llvm::Type *ArgTys[] = {Arg0->getType(), I8PTy, Int32Ty, Int32Ty};
       llvm::FunctionType *FTy = llvm::FunctionType::get(
           Int32Ty, llvm::ArrayRef<llvm::Type *>(ArgTys), false);
-      Value *BCast = Builder.CreatePointerCast(Arg1, I8PTy);
+      Value *ACast = Builder.CreateAddrSpaceCast(Arg1, I8PTy);
       return RValue::get(
           EmitRuntimeCall(CGM.CreateRuntimeFunction(FTy, Name),
-                          {Arg0, BCast, PacketSize, PacketAlign}));
+                          {Arg0, ACast, PacketSize, PacketAlign}));
     } else {
       assert(4 == E->getNumArgs() &&
              "Illegal number of parameters to pipe function");


        


More information about the cfe-commits mailing list