[llvm] r334269 - AMDGPU: Error on LDS global address in functions
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 8 01:05:54 PDT 2018
Author: arsenm
Date: Fri Jun 8 01:05:54 2018
New Revision: 334269
URL: http://llvm.org/viewvc/llvm-project?rev=334269&view=rev
Log:
AMDGPU: Error on LDS global address in functions
These won't work as expected now, so error on them to avoid
wasting time debugging this in the future.
Added:
llvm/trunk/test/CodeGen/AMDGPU/lds-global-non-entry-func.ll
Modified:
llvm/trunk/lib/Target/AMDGPU/AMDGPUISelLowering.cpp
Modified: llvm/trunk/lib/Target/AMDGPU/AMDGPUISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AMDGPU/AMDGPUISelLowering.cpp?rev=334269&r1=334268&r2=334269&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AMDGPU/AMDGPUISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/AMDGPU/AMDGPUISelLowering.cpp Fri Jun 8 01:05:54 2018
@@ -1272,7 +1272,15 @@ SDValue AMDGPUTargetLowering::LowerGloba
GlobalAddressSDNode *G = cast<GlobalAddressSDNode>(Op);
const GlobalValue *GV = G->getGlobal();
- if (G->getAddressSpace() == AMDGPUASI.LOCAL_ADDRESS) {
+ if (G->getAddressSpace() == AMDGPUASI.LOCAL_ADDRESS ||
+ G->getAddressSpace() == AMDGPUASI.REGION_ADDRESS) {
+ if (!MFI->isEntryFunction()) {
+ const Function &Fn = DAG.getMachineFunction().getFunction();
+ DiagnosticInfoUnsupported BadLDSDecl(
+ Fn, "local memory global used by non-kernel function", SDLoc(Op).getDebugLoc());
+ DAG.getContext()->diagnose(BadLDSDecl);
+ }
+
// XXX: What does the value of G->getOffset() mean?
assert(G->getOffset() == 0 &&
"Do not know what to do with an non-zero offset");
Added: llvm/trunk/test/CodeGen/AMDGPU/lds-global-non-entry-func.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/AMDGPU/lds-global-non-entry-func.ll?rev=334269&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/AMDGPU/lds-global-non-entry-func.ll (added)
+++ llvm/trunk/test/CodeGen/AMDGPU/lds-global-non-entry-func.ll Fri Jun 8 01:05:54 2018
@@ -0,0 +1,9 @@
+; RUN: not llc -mtriple=amdgcn-amd-amdhsa -o /dev/null %s 2>&1 | FileCheck %s
+
+ at lds = internal addrspace(3) global float undef, align 4
+
+; CHECK: error: <unknown>:0:0: in function func_use_lds_global void (): local memory global used by non-kernel function
+define void @func_use_lds_global() {
+ store float 0.0, float addrspace(3)* @lds, align 4
+ ret void
+}
More information about the llvm-commits
mailing list