[llvm-bugs] [Bug 50270] New: [Inliner] noalias metadata incorrectly propagated to caller instructions
via llvm-bugs
llvm-bugs at lists.llvm.org
Sat May 8 02:53:51 PDT 2021
https://bugs.llvm.org/show_bug.cgi?id=50270
Bug ID: 50270
Summary: [Inliner] noalias metadata incorrectly propagated to
caller instructions
Product: libraries
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Interprocedural Optimizations
Assignee: unassignedbugs at nondot.org
Reporter: nikita.ppv at gmail.com
CC: jeroen.dobbelaere at synopsys.com,
llvm-bugs at lists.llvm.org
Blocks: 49317
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
https://github.com/llvm/llvm-project/blob/d4bdeca5765ac2e81e217a5fa873d1ffbf0e95b0/llvm/lib/Transforms/Utils/InlineFunction.cpp#L796-L799
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 https://github.com/rust-lang/rust/issues/84958.
Referenced Bugs:
https://bugs.llvm.org/show_bug.cgi?id=49317
[Bug 49317] [meta] 12.0.1 Release Blockers
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210508/535848cb/attachment.html>
More information about the llvm-bugs
mailing list