1 ; RUN: opt -codegenprepare -S < %s | FileCheck %s
3 target triple = "armv8m.main-none-eabi"
8 define i8* @tail_dup() {
9 ; CHECK-LABEL: tail_dup
10 ; CHECK: tail call i8* @f0()
12 ; CHECK: tail call i8* @f1()
15 %tmp0 = tail call i8* @f0()
18 %tmp1 = tail call i8* @f1()
21 %retval = phi i8* [ %tmp0, %bb0 ], [ %tmp1, %bb1 ]
25 define nonnull i8* @nonnull_dup() {
26 ; CHECK-LABEL: nonnull_dup
27 ; CHECK: tail call i8* @f0()
29 ; CHECK: tail call i8* @f1()
32 %tmp0 = tail call i8* @f0()
35 %tmp1 = tail call i8* @f1()
38 %retval = phi i8* [ %tmp0, %bb0 ], [ %tmp1, %bb1 ]
42 define i8* @noalias_dup() {
43 ; CHECK-LABEL: noalias_dup
44 ; CHECK: tail call noalias i8* @f0()
46 ; CHECK: tail call noalias i8* @f1()
49 %tmp0 = tail call noalias i8* @f0()
52 %tmp1 = tail call noalias i8* @f1()
55 %retval = phi i8* [ %tmp0, %bb0 ], [ %tmp1, %bb1 ]
59 ; Use inreg as a way of testing that attributes (other than nonnull and
60 ; noalias) disable the tailcall duplication in cgp.
62 define inreg i8* @inreg_nodup() {
63 ; CHECK-LABEL: inreg_nodup
64 ; CHECK: tail call i8* @f0()
65 ; CHECK-NEXT: br label %return
66 ; CHECK: tail call i8* @f1()
67 ; CHECK-NEXT: br label %return
69 %tmp0 = tail call i8* @f0()
72 %tmp1 = tail call i8* @f1()
75 %retval = phi i8* [ %tmp0, %bb0 ], [ %tmp1, %bb1 ]