blob: 674da1e2efbb32f9087ba463c28a012626a507f0 [file] [log] [blame]
Hal Finkelff0bcb62014-07-25 15:50:08 +00001; RUN: opt -inline -enable-noalias-to-md-conversion -S < %s | FileCheck %s
2target 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"
3target triple = "x86_64-unknown-linux-gnu"
4
5define void @hello(float* noalias nocapture %a, float* nocapture readonly %c) #0 {
6entry:
7 %0 = load float* %c, align 4
8 %arrayidx = getelementptr inbounds float* %a, i64 5
9 store float %0, float* %arrayidx, align 4
10 ret void
11}
12
13define void @foo(float* nocapture %a, float* nocapture readonly %c) #0 {
14entry:
15 tail call void @hello(float* %a, float* %c)
16 %0 = load float* %c, align 4
17 %arrayidx = getelementptr inbounds float* %a, i64 7
18 store float %0, float* %arrayidx, align 4
19 ret void
20}
21
22; CHECK: define void @foo(float* nocapture %a, float* nocapture readonly %c) #0 {
23; CHECK: entry:
24; CHECK: %0 = load float* %c, align 4, !noalias !0
25; CHECK: %arrayidx.i = getelementptr inbounds float* %a, i64 5
26; CHECK: store float %0, float* %arrayidx.i, align 4, !alias.scope !0
27; CHECK: %1 = load float* %c, align 4
28; CHECK: %arrayidx = getelementptr inbounds float* %a, i64 7
29; CHECK: store float %1, float* %arrayidx, align 4
30; CHECK: ret void
31; CHECK: }
32
33define void @hello2(float* noalias nocapture %a, float* noalias nocapture %b, float* nocapture readonly %c) #0 {
34entry:
35 %0 = load float* %c, align 4
36 %arrayidx = getelementptr inbounds float* %a, i64 5
37 store float %0, float* %arrayidx, align 4
38 %arrayidx1 = getelementptr inbounds float* %b, i64 8
39 store float %0, float* %arrayidx1, align 4
40 ret void
41}
42
43define void @foo2(float* nocapture %a, float* nocapture %b, float* nocapture readonly %c) #0 {
44entry:
45 tail call void @hello2(float* %a, float* %b, float* %c)
46 %0 = load float* %c, align 4
47 %arrayidx = getelementptr inbounds float* %a, i64 7
48 store float %0, float* %arrayidx, align 4
49 ret void
50}
51
52; CHECK: define void @foo2(float* nocapture %a, float* nocapture %b, float* nocapture readonly %c) #0 {
53; CHECK: entry:
54; CHECK: %0 = load float* %c, align 4, !noalias !3
55; CHECK: %arrayidx.i = getelementptr inbounds float* %a, i64 5
56; CHECK: store float %0, float* %arrayidx.i, align 4, !alias.scope !7, !noalias !8
57; CHECK: %arrayidx1.i = getelementptr inbounds float* %b, i64 8
58; CHECK: store float %0, float* %arrayidx1.i, align 4, !alias.scope !8, !noalias !7
59; CHECK: %1 = load float* %c, align 4
60; CHECK: %arrayidx = getelementptr inbounds float* %a, i64 7
61; CHECK: store float %1, float* %arrayidx, align 4
62; CHECK: ret void
63; CHECK: }
64
65attributes #0 = { nounwind uwtable }
66
Duncan P. N. Exon Smithbe7ea192014-12-15 19:07:53 +000067; CHECK: !0 = !{!1}
Duncan P. N. Exon Smith090a19b2015-01-08 22:38:29 +000068; CHECK: !1 = distinct !{!1, !2, !"hello: %a"}
69; CHECK: !2 = distinct !{!2, !"hello"}
Duncan P. N. Exon Smithbe7ea192014-12-15 19:07:53 +000070; CHECK: !3 = !{!4, !6}
Duncan P. N. Exon Smith090a19b2015-01-08 22:38:29 +000071; CHECK: !4 = distinct !{!4, !5, !"hello2: %a"}
72; CHECK: !5 = distinct !{!5, !"hello2"}
73; CHECK: !6 = distinct !{!6, !5, !"hello2: %b"}
Duncan P. N. Exon Smithbe7ea192014-12-15 19:07:53 +000074; CHECK: !7 = !{!4}
75; CHECK: !8 = !{!6}
Hal Finkelff0bcb62014-07-25 15:50:08 +000076