<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - [Inliner] noalias metadata incorrectly propagated to caller instructions"
href="https://bugs.llvm.org/show_bug.cgi?id=50270">50270</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>[Inliner] noalias metadata incorrectly propagated to caller instructions
</td>
</tr>
<tr>
<th>Product</th>
<td>libraries
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Interprocedural Optimizations
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>nikita.ppv@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>jeroen.dobbelaere@synopsys.com, llvm-bugs@lists.llvm.org
</td>
</tr>
<tr>
<th>Blocks</th>
<td>49317
</td>
</tr></table>
<p>
<div>
<pre>declare { i64 } @opaque_callee()
define { i64 } @callee(i64 %x) {
%res = insertvalue { i64 } undef, i64 %x, 0
ret { i64 } %res
}
define i64 @caller(i64* %p) {
%s = call { i64 } @opaque_callee()
%x = extractvalue { i64 } %s, 0
call { i64 } @callee(i64 %x), !noalias !2
%y = load i64, i64* %p, !alias.scope !2
ret i64 %y
}
!0 = !{!0, !"domain"}
!1 = !{!1, !0, !"scope"}
!2 = !{!1}
; RUN: opt -S -inline < %s
declare { i64 } @opaque_callee()
define { i64 } @callee(i64 %x) {
%res = insertvalue { i64 } undef, i64 %x, 0
ret { i64 } %res
}
define i64 @caller(i64* %p) {
%s = call { i64 } @opaque_callee(), !noalias !0
%x = extractvalue { i64 } %s, 0
%y = load i64, i64* %p, align 4, !alias.scope !0
ret i64 %y
}
!0 = !{!1}
!1 = distinct !{!1, !2, !"scope"}
!2 = distinct !{!2, !"domain"}
The !noalias metadata on the @callee() call is propagated to the
@opaque_callee() call from the caller.
This happens because VMap may map to instructions from the caller if
simplification occurred. The existing check in
<a href="https://github.com/llvm/llvm-project/blob/d4bdeca5765ac2e81e217a5fa873d1ffbf0e95b0/llvm/lib/Transforms/Utils/InlineFunction.cpp#L796-L799">https://github.com/llvm/llvm-project/blob/d4bdeca5765ac2e81e217a5fa873d1ffbf0e95b0/llvm/lib/Transforms/Utils/InlineFunction.cpp#L796-L799</a>
protects against a similar problem, but does not cover this case.
I believe the same basic problem also applies to a few other VMap walks inside
the inliner.
This was originally reported at <a href="https://github.com/rust-lang/rust/issues/84958">https://github.com/rust-lang/rust/issues/84958</a>.</pre>
</div>
</p>
<div id="referenced">
<hr style="border: 1px dashed #969696">
<b>Referenced Bugs:</b>
<ul>
<li>
[<a class="bz_bug_link
bz_status_NEW "
title="NEW - [meta] 12.0.1 Release Blockers"
href="https://bugs.llvm.org/show_bug.cgi?id=49317">Bug 49317</a>] [meta] 12.0.1 Release Blockers
</li>
</ul>
</div>
<br>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>