xref: /aosp_15_r20/external/llvm/test/Transforms/Inline/noalias.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: opt -inline -enable-noalias-to-md-conversion -S < %s | FileCheck %s
2*9880d681SAndroid Build Coastguard Workertarget datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
3*9880d681SAndroid Build Coastguard Workertarget triple = "x86_64-unknown-linux-gnu"
4*9880d681SAndroid Build Coastguard Worker
5*9880d681SAndroid Build Coastguard Workerdefine void @hello(float* noalias nocapture %a, float* nocapture readonly %c) #0 {
6*9880d681SAndroid Build Coastguard Workerentry:
7*9880d681SAndroid Build Coastguard Worker  %0 = load float, float* %c, align 4
8*9880d681SAndroid Build Coastguard Worker  %arrayidx = getelementptr inbounds float, float* %a, i64 5
9*9880d681SAndroid Build Coastguard Worker  store float %0, float* %arrayidx, align 4
10*9880d681SAndroid Build Coastguard Worker  ret void
11*9880d681SAndroid Build Coastguard Worker}
12*9880d681SAndroid Build Coastguard Worker
13*9880d681SAndroid Build Coastguard Workerdefine void @foo(float* nocapture %a, float* nocapture readonly %c) #0 {
14*9880d681SAndroid Build Coastguard Workerentry:
15*9880d681SAndroid Build Coastguard Worker  tail call void @hello(float* %a, float* %c)
16*9880d681SAndroid Build Coastguard Worker  %0 = load float, float* %c, align 4
17*9880d681SAndroid Build Coastguard Worker  %arrayidx = getelementptr inbounds float, float* %a, i64 7
18*9880d681SAndroid Build Coastguard Worker  store float %0, float* %arrayidx, align 4
19*9880d681SAndroid Build Coastguard Worker  ret void
20*9880d681SAndroid Build Coastguard Worker}
21*9880d681SAndroid Build Coastguard Worker
22*9880d681SAndroid Build Coastguard Worker; CHECK: define void @foo(float* nocapture %a, float* nocapture readonly %c) #0 {
23*9880d681SAndroid Build Coastguard Worker; CHECK: entry:
24*9880d681SAndroid Build Coastguard Worker; CHECK:   %0 = load float, float* %c, align 4, !noalias !0
25*9880d681SAndroid Build Coastguard Worker; CHECK:   %arrayidx.i = getelementptr inbounds float, float* %a, i64 5
26*9880d681SAndroid Build Coastguard Worker; CHECK:   store float %0, float* %arrayidx.i, align 4, !alias.scope !0
27*9880d681SAndroid Build Coastguard Worker; CHECK:   %1 = load float, float* %c, align 4
28*9880d681SAndroid Build Coastguard Worker; CHECK:   %arrayidx = getelementptr inbounds float, float* %a, i64 7
29*9880d681SAndroid Build Coastguard Worker; CHECK:   store float %1, float* %arrayidx, align 4
30*9880d681SAndroid Build Coastguard Worker; CHECK:   ret void
31*9880d681SAndroid Build Coastguard Worker; CHECK: }
32*9880d681SAndroid Build Coastguard Worker
33*9880d681SAndroid Build Coastguard Workerdefine void @hello2(float* noalias nocapture %a, float* noalias nocapture %b, float* nocapture readonly %c) #0 {
34*9880d681SAndroid Build Coastguard Workerentry:
35*9880d681SAndroid Build Coastguard Worker  %0 = load float, float* %c, align 4
36*9880d681SAndroid Build Coastguard Worker  %arrayidx = getelementptr inbounds float, float* %a, i64 5
37*9880d681SAndroid Build Coastguard Worker  store float %0, float* %arrayidx, align 4
38*9880d681SAndroid Build Coastguard Worker  %arrayidx1 = getelementptr inbounds float, float* %b, i64 8
39*9880d681SAndroid Build Coastguard Worker  store float %0, float* %arrayidx1, align 4
40*9880d681SAndroid Build Coastguard Worker  ret void
41*9880d681SAndroid Build Coastguard Worker}
42*9880d681SAndroid Build Coastguard Worker
43*9880d681SAndroid Build Coastguard Workerdefine void @foo2(float* nocapture %a, float* nocapture %b, float* nocapture readonly %c) #0 {
44*9880d681SAndroid Build Coastguard Workerentry:
45*9880d681SAndroid Build Coastguard Worker  tail call void @hello2(float* %a, float* %b, float* %c)
46*9880d681SAndroid Build Coastguard Worker  %0 = load float, float* %c, align 4
47*9880d681SAndroid Build Coastguard Worker  %arrayidx = getelementptr inbounds float, float* %a, i64 7
48*9880d681SAndroid Build Coastguard Worker  store float %0, float* %arrayidx, align 4
49*9880d681SAndroid Build Coastguard Worker  ret void
50*9880d681SAndroid Build Coastguard Worker}
51*9880d681SAndroid Build Coastguard Worker
52*9880d681SAndroid Build Coastguard Worker; CHECK: define void @foo2(float* nocapture %a, float* nocapture %b, float* nocapture readonly %c) #0 {
53*9880d681SAndroid Build Coastguard Worker; CHECK: entry:
54*9880d681SAndroid Build Coastguard Worker; CHECK:   %0 = load float, float* %c, align 4, !noalias !3
55*9880d681SAndroid Build Coastguard Worker; CHECK:   %arrayidx.i = getelementptr inbounds float, float* %a, i64 5
56*9880d681SAndroid Build Coastguard Worker; CHECK:   store float %0, float* %arrayidx.i, align 4, !alias.scope !7, !noalias !8
57*9880d681SAndroid Build Coastguard Worker; CHECK:   %arrayidx1.i = getelementptr inbounds float, float* %b, i64 8
58*9880d681SAndroid Build Coastguard Worker; CHECK:   store float %0, float* %arrayidx1.i, align 4, !alias.scope !8, !noalias !7
59*9880d681SAndroid Build Coastguard Worker; CHECK:   %1 = load float, float* %c, align 4
60*9880d681SAndroid Build Coastguard Worker; CHECK:   %arrayidx = getelementptr inbounds float, float* %a, i64 7
61*9880d681SAndroid Build Coastguard Worker; CHECK:   store float %1, float* %arrayidx, align 4
62*9880d681SAndroid Build Coastguard Worker; CHECK:   ret void
63*9880d681SAndroid Build Coastguard Worker; CHECK: }
64*9880d681SAndroid Build Coastguard Worker
65*9880d681SAndroid Build Coastguard Workerattributes #0 = { nounwind uwtable }
66*9880d681SAndroid Build Coastguard Worker
67*9880d681SAndroid Build Coastguard Worker; CHECK: !0 = !{!1}
68*9880d681SAndroid Build Coastguard Worker; CHECK: !1 = distinct !{!1, !2, !"hello: %a"}
69*9880d681SAndroid Build Coastguard Worker; CHECK: !2 = distinct !{!2, !"hello"}
70*9880d681SAndroid Build Coastguard Worker; CHECK: !3 = !{!4, !6}
71*9880d681SAndroid Build Coastguard Worker; CHECK: !4 = distinct !{!4, !5, !"hello2: %a"}
72*9880d681SAndroid Build Coastguard Worker; CHECK: !5 = distinct !{!5, !"hello2"}
73*9880d681SAndroid Build Coastguard Worker; CHECK: !6 = distinct !{!6, !5, !"hello2: %b"}
74*9880d681SAndroid Build Coastguard Worker; CHECK: !7 = !{!4}
75*9880d681SAndroid Build Coastguard Worker; CHECK: !8 = !{!6}
76*9880d681SAndroid Build Coastguard Worker
77