[clang] d43c081 - [clang][CGOpenMPRuntimeGPU] Merge consecutive AddrSpaceCasts (NFC) (#74279)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Dec 4 04:03:13 PST 2023
Author: Youngsuk Kim
Date: 2023-12-04T07:03:09-05:00
New Revision: d43c081aef505b0f1d5e887a365cd69e7f9f37b2
URL: https://github.com/llvm/llvm-project/commit/d43c081aef505b0f1d5e887a365cd69e7f9f37b2
DIFF: https://github.com/llvm/llvm-project/commit/d43c081aef505b0f1d5e887a365cd69e7f9f37b2.diff
LOG: [clang][CGOpenMPRuntimeGPU] Merge consecutive AddrSpaceCasts (NFC) (#74279)
Merge consecutive AddrSpaceCasts into a single AddrSpaceCast.
Added:
Modified:
clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
Removed:
################################################################################
diff --git a/clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp b/clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
index 5b9dbbf7e83a9..293ccaa3413cd 100644
--- a/clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
+++ b/clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
@@ -3017,11 +3017,7 @@ CGOpenMPRuntimeGPU::getParameterAddress(CodeGenFunction &CGF,
QualType TargetTy = TargetParam->getType();
llvm::Value *TargetAddr = CGF.EmitLoadOfScalar(LocalAddr, /*Volatile=*/false,
TargetTy, SourceLocation());
- // First cast to generic.
- TargetAddr = CGF.Builder.CreatePointerBitCastOrAddrSpaceCast(
- TargetAddr,
- llvm::PointerType::get(CGF.getLLVMContext(), /*AddrSpace=*/0));
- // Cast from generic to native address space.
+ // Cast to native address space.
TargetAddr = CGF.Builder.CreatePointerBitCastOrAddrSpaceCast(
TargetAddr,
llvm::PointerType::get(CGF.getLLVMContext(), NativePointeeAddrSpace));
@@ -3048,11 +3044,8 @@ void CGOpenMPRuntimeGPU::emitOutlinedFunctionCall(
TargetArgs.emplace_back(NativeArg);
continue;
}
- llvm::Value *TargetArg = CGF.Builder.CreatePointerBitCastOrAddrSpaceCast(
- NativeArg,
- llvm::PointerType::get(CGF.getLLVMContext(), /*AddrSpace*/ 0));
TargetArgs.emplace_back(
- CGF.Builder.CreatePointerBitCastOrAddrSpaceCast(TargetArg, TargetType));
+ CGF.Builder.CreatePointerBitCastOrAddrSpaceCast(NativeArg, TargetType));
}
CGOpenMPRuntime::emitOutlinedFunctionCall(CGF, Loc, OutlinedFn, TargetArgs);
}
More information about the cfe-commits
mailing list