[clang] [OpenCL] Replace a CreatePointerCast call; NFC (PR #112676)
Sven van Haastregt via cfe-commits
cfe-commits at lists.llvm.org
Thu Oct 17 01:17:25 PDT 2024
https://github.com/svenvh created https://github.com/llvm/llvm-project/pull/112676
With opaque pointers, the only purpose of the cast here is to cast between address spaces, similar to the 4-argument case below.
>From 7dff616c6cd8ffb2c58e26132370f9329a0bf4cd Mon Sep 17 00:00:00 2001
From: Sven van Haastregt <sven.vanhaastregt at arm.com>
Date: Thu, 17 Oct 2024 09:01:14 +0100
Subject: [PATCH] [OpenCL] Replace a CreatePointerCast call; NFC
With opaque pointers, the only purpose of the cast here is to cast
between address spaces, similar to the 4-argument case below.
---
clang/lib/CodeGen/CGBuiltin.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
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");
More information about the cfe-commits
mailing list