-
Notifications
You must be signed in to change notification settings - Fork 11.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[OpenCL] Replace a CreatePointerCast call; NFC #112676
Conversation
With opaque pointers, the only purpose of the cast here is to cast between address spaces, similar to the 4-argument case below.
@llvm/pr-subscribers-clang-codegen @llvm/pr-subscribers-clang Author: Sven van Haastregt (svenvh) ChangesWith 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:
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");
|
llvm-project/llvm/include/llvm/IR/IRBuilder.h Lines 2197 to 2204 in 6d7712a
while llvm-project/llvm/include/llvm/IR/IRBuilder.h Lines 2159 to 2162 in 6d7712a
LLVM LangRef says that |
Oh.. llvm-project/llvm/include/llvm/IR/IRBuilder.h Lines 2188 to 2195 in 6d7712a
|
With opaque pointers, the only purpose of the cast here is to cast between address spaces, similar to the 4-argument case below.