<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/54785>54785</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Module verifier failed on a call with "clang.arc.attachedcall".
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
ahatanak
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
kyulee-com
</td>
</tr>
</table>
<pre>
The following test crashes with:
```
a call with operand bundle "clang.arc.attachedcall" must call a function returning a pointer or a non-returning function that has a void return type tail call fastcc void @foo1() #4 [ "clang.arc.attachedcall"(i8* (i8*)* @llvm.objc.retainAutoreleasedReturnValue) ]
```
`DeadArgumentEliminationPass` deletes the return value which is not needed since `null` value seems constant-propagated.
The subsequent module verifier failed to assert this. I wonder if we should simply relax this assertion, https://github.com/llvm/llvm-project/blob/7c53fc4fe1308f5b2a7527d14ea41fabb18109b8/llvm/lib/IR/Verifier.cpp#L6014-L6015
```
; RUN: opt -Oz -S %s -o -
@g = local_unnamed_addr global i32 0, align 4
define internal i8* @foo0() minsize noinline {
store i32 1, i32* @g, align 4
ret i8* null
}
define internal i8* @foo1() minsize noinline {
store i32 2, i32* @g, align 4
ret i8* null
}
define i32 @test(i64 %arg) {
entry:
%0 = icmp eq i64 %arg, 0
br i1 %0, label %T, label %F
T:
%call0 = tail call i8* @foo0() minsize [ "clang.arc.attachedcall"(i8* (i8*)* @llvm.objc.retainAutoreleasedReturnValue)]
br label %M
F:
%call1 = tail call i8* @foo1() minsize [ "clang.arc.attachedcall"(i8* (i8*)* @llvm.objc.retainAutoreleasedReturnValue)]
br label %M
M:
%1 = phi i8* [%call1, %F], [%call0, %T]
tail call void (...) @llvm.objc.clang.arc.noop.use(i8* %1)
%2 = load i32, i32* @g, align 4
ret i32 %2
}
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzNVtuOpDYQ_Rr6pdQIDPTloR96tjPSSpk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