Skip to content

Commit 0884da8

Browse files
author
git apple-llvm automerger
committed
Merge commit 'cafad2b75a6e' from llvm.org/main into next
2 parents e51e485 + cafad2b commit 0884da8

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

llvm/lib/IR/Verifier.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6459,6 +6459,14 @@ void Verifier::visitIntrinsicCall(Intrinsic::ID ID, CallBase &Call) {
64596459
"llvm.amdgcn.cs.chain must be followed by unreachable", &Call);
64606460
break;
64616461
}
6462+
case Intrinsic::amdgcn_init_exec_from_input: {
6463+
const Argument *Arg = dyn_cast<Argument>(Call.getOperand(0));
6464+
Check(Arg && Arg->hasInRegAttr(),
6465+
"only inreg arguments to the parent function are valid as inputs to "
6466+
"this intrinsic",
6467+
&Call);
6468+
break;
6469+
}
64626470
case Intrinsic::amdgcn_set_inactive_chain_arg: {
64636471
auto CallerCC = Call.getCaller()->getCallingConv();
64646472
switch (CallerCC) {
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
; RUN: not llvm-as -disable-output 2>&1 %s | FileCheck %s
2+
3+
declare void @llvm.amdgcn.init.exec.from.input(i32, i32 immarg)
4+
5+
; CHECK: only inreg arguments to the parent function are valid as inputs to this intrinsic
6+
; CHECK-NEXT: call void @llvm.amdgcn.init.exec.from.input(i32 0, i32 0)
7+
define void @init_exec_from_input_fail_constant() {
8+
call void @llvm.amdgcn.init.exec.from.input(i32 0, i32 0)
9+
ret void
10+
}
11+
12+
; CHECK: only inreg arguments to the parent function are valid as inputs to this intrinsic
13+
; CHECK-NEXT: call void @llvm.amdgcn.init.exec.from.input(i32 %b, i32 0)
14+
define void @init_exec_from_input_fail_not_inreg(i32 inreg %a, i32 %b) {
15+
call void @llvm.amdgcn.init.exec.from.input(i32 %b, i32 0)
16+
ret void
17+
}
18+
19+
; CHECK: only inreg arguments to the parent function are valid as inputs to this intrinsic
20+
; CHECK-NEXT: call void @llvm.amdgcn.init.exec.from.input(i32 %c, i32 0)
21+
define void @init_exec_from_input_fail_instruction(i32 inreg %a, i32 %b) {
22+
%c = add i32 %a, %b
23+
call void @llvm.amdgcn.init.exec.from.input(i32 %c, i32 0)
24+
ret void
25+
}

0 commit comments

Comments
 (0)