[clang] [OpenCL] Replace a CreatePointerCast call; NFC (PR #112676)

via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 17 01:17:59 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Sven van Haastregt (svenvh)

<details>
<summary>Changes</summary>

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

---
Full diff: https://github.com/llvm/llvm-project/pull/112676.diff


1 Files Affected:

- (modified) clang/lib/CodeGen/CGBuiltin.cpp (+2-2) 


``````````diff
diff --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp
index f6d7db2c204c12..b2af4295fe99fe 100644
--- a/clang/lib/CodeGen/CGBuiltin.cpp
+++ b/clang/lib/CodeGen/CGBuiltin.cpp
@@ -5641,10 +5641,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");

``````````

</details>


https://github.com/llvm/llvm-project/pull/112676


More information about the cfe-commits mailing list