1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 20:23:11 +01:00
llvm-mirror/test/Transforms/Inline/pr48209.ll
Nikita Popov 3912b90160 [Inline] Fix incorrect noalias metadata application (PR48209)
The VMap also contains a mapping from Argument => Instruction,
where the instruction is part of the original function, not the
inlined one. The code was assuming that all the instructions in
the VMap were inlined.

This was a pre-existing problem for the loop access metadata, but
was extended to the more common noalias metadata by
27f647d117087ca11959e232e6443f4aee31e966, thus causing miscompiles.

There is a similar assumption inside CloneAliasScopeMetadata(), so
that one likely needs to be fixed as well.
2020-11-18 20:52:58 +01:00

26 lines
695 B
LLVM

; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -inline -S < %s | FileCheck %s
declare void @external_function(i8*)
define internal void @inlined_function(i8* %arg) {
call void @external_function(i8* %arg)
ret void
}
; TODO: This is a miscompile.
define void @test(i8** %p) {
; CHECK-LABEL: @test(
; CHECK-NEXT: [[ARG:%.*]] = load i8*, i8** [[P:%.*]], align 8, !alias.scope !0
; CHECK-NEXT: call void @external_function(i8* [[ARG]]), !noalias !0
; CHECK-NEXT: ret void
;
%arg = load i8*, i8** %p, !alias.scope !0
tail call void @inlined_function(i8* %arg), !noalias !0
ret void
}
!0 = !{!1}
!1 = distinct !{!1, !2}
!2 = distinct !{!2}