Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions llvm/lib/IR/Verifier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2938,10 +2938,16 @@ void Verifier::visitFunction(const Function &F) {
"Calling convention parameter requires byval", &F);
break;
}
case CallingConv::AMDGPU_KERNEL:
case CallingConv::SPIR_KERNEL:
case CallingConv::AMDGPU_CS_Chain:
case CallingConv::AMDGPU_CS_ChainPreserve:
{
auto TT = M.getTargetTriple().str();
if (TT.find("gfx1200") || TT.find("gfx942"))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is unacceptable. We should never do this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What other way does one check for subtarget?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The IR verifier cannot and should not check for the subtarget. We cannot have subtarget dependent IR valid rules

Check(false, "Chain calling convention is invalid on this target", &F);
}
[[fallthrough]];
case CallingConv::AMDGPU_KERNEL:
case CallingConv::SPIR_KERNEL:
Check(F.getReturnType()->isVoidTy(),
"Calling convention requires void return type", &F);
[[fallthrough]];
Expand Down
6 changes: 6 additions & 0 deletions llvm/test/CodeGen/AMDGPU/amdgpu-cs-chain-invalid-arch.ll
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
; RUN: not llc -mtriple=amdgcn -mcpu=gfx1200 -o - < %s 2>&1 | FileCheck %s

define amdgpu_cs_chain void @test_alloca() {
; CHECK: Chain calling convention is invalid on this target
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would just fix this restriction, this seems totally artificial

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#132711 fixes the restriction, but they mentioned that the IR is invalid for this architecture, so the PR was never approved.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reject the notion that IR can be invalid for an architecture

ret void
}
Loading