================
@@ -421,6 +578,39 @@ bool AMDGPUPromoteAllocaImpl::run(Function &F, bool
PromoteToLDS) {
bool Changed = false;
SetVector<IntrinsicInst *> DeferredIntrs;
for (AllocaAnalysis &AA : Allocas) {
+ if (AA.Alloca->getAddressSpace() == AMDGPUAS::VGPR) {
+ // Fall back to scratch (and warn) when the object can't be kept in
+ // registers, so the program still compiles correctly: either the target
+ // does not support "VGPR as memory", or the access pattern (dynamic
+ // index, sub-dword, escaping address) is not yet supported.
+ const char *Unsupported = nullptr;
+ if (!TargetSupportsVGPRAsMemory)
+ Unsupported = "not supported on this target";
+ else if (!isVGPRAllocaStaticallyLowerable(*AA.Alloca, *DL))
+ Unsupported = "dynamic indexing, sub-dword access, or escaping address
"
+ "is not yet supported";
+ if (Unsupported) {
+ F.getContext().diagnose(DiagnosticInfoUnsupported(
+ F,
+ Twine("'amdgpu_vgpr' object could not be kept in vector registers "
+ "(") +
+ Unsupported + "); using scratch memory instead",
----------------
arsenm wrote:
This cannot be a failure, this is the upfront design mistake bubbling through.
DiagnosticInfoUnsupported should only be used in cases were the IR is
structurally not handled, like the backend is missing functionality. This can't
be oops the IR didn't optimize well enough to give the codegen you wanted
https://github.com/llvm/llvm-project/pull/205435
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits