[clang] [clang][CGOpenMPRuntimeGPU] Merge consecutive AddrSpaceCasts (NFC) (PR #74279)
Youngsuk Kim via cfe-commits
cfe-commits at lists.llvm.org
Sun Dec 3 22:09:13 PST 2023
https://github.com/JOE1994 created https://github.com/llvm/llvm-project/pull/74279
Merge consecutive AddrSpaceCasts into a single AddrSpaceCast.
>From 4e86272d980b26bf1240df94cbc894e7ded0d018 Mon Sep 17 00:00:00 2001
From: Youngsuk Kim <youngsuk.kim at hpe.com>
Date: Sun, 3 Dec 2023 23:52:33 -0600
Subject: [PATCH] [clang][CGOpenMPRuntimeGPU] Merge consecutive AddrSpaceCasts
(NFC)
Merge consecutive AddrSpaceCasts into a single AddrSpaceCast.
---
clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp | 11 ++---------
1 file changed, 2 insertions(+), 9 deletions(-)
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