[PATCH] D114849: [AMDGPU][clang] Fix __builtin_nontemporal_store() failure on AMDGPU
krishna chaitanya sankisa via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Dec 1 21:55:45 PST 2021
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG16b781e6d16d: [AMDGPU][clang] Fix __builtin_nontemporal_store() failure on AMDGPU (authored by skc7).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D114849/new/
https://reviews.llvm.org/D114849
Files:
clang/lib/CodeGen/CGBuiltin.cpp
clang/test/CodeGenOpenCL/amdgcn-non-temporal-store.cl
Index: clang/test/CodeGenOpenCL/amdgcn-non-temporal-store.cl
===================================================================
--- /dev/null
+++ clang/test/CodeGenOpenCL/amdgcn-non-temporal-store.cl
@@ -0,0 +1,8 @@
+// REQUIRES: amdgpu-registered-target
+// RUN: %clang_cc1 -triple amdgcn-unknown-unknown -S -emit-llvm -o - %s | FileCheck %s
+// CHECK-LABEL: @test_non_temporal_store_kernel
+// CHECK: store i32 0, i32 addrspace(1)* %{{.*}}, align 4, !tbaa !{{.*}}, !nontemporal {{.*}}
+
+kernel void test_non_temporal_store_kernel(global unsigned int* io) {
+ __builtin_nontemporal_store(0, io);
+}
Index: clang/lib/CodeGen/CGBuiltin.cpp
===================================================================
--- clang/lib/CodeGen/CGBuiltin.cpp
+++ clang/lib/CodeGen/CGBuiltin.cpp
@@ -170,8 +170,9 @@
// Convert the type of the pointer to a pointer to the stored type.
Val = CGF.EmitToMemory(Val, E->getArg(0)->getType());
+ unsigned SrcAddrSpace = Address->getType()->getPointerAddressSpace();
Value *BC = CGF.Builder.CreateBitCast(
- Address, llvm::PointerType::getUnqual(Val->getType()), "cast");
+ Address, llvm::PointerType::get(Val->getType(), SrcAddrSpace), "cast");
LValue LV = CGF.MakeNaturalAlignAddrLValue(BC, E->getArg(0)->getType());
LV.setNontemporal(true);
CGF.EmitStoreOfScalar(Val, LV, false);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D114849.391213.patch
Type: text/x-patch
Size: 1343 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20211202/30261569/attachment.bin>
More information about the cfe-commits
mailing list