3 ; RUN: opt -passes=loop-vectorize -debug-only=loop-vectorize -force-vector-interleave=1 -force-vector-width=4 -vplan-print-in-dot-format -disable-output %s 2>&1 | FileCheck %s
5 target 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"
7 ; Verify that -vplan-print-in-dot-format option works.
9 define void @print_call_and_memory(i64 %n, ptr noalias %y, ptr noalias %x) nounwind uwtable {
10 ; CHECK: digraph VPlan {
11 ; CHECK-NEXT: graph [labelloc=t, fontsize=30; label="Vectorization Plan\nInitial VPlan for VF=\{4\},UF\>=1\nLive-in vp\<[[VFxUF:%.+]]\> = VF * UF\nLive-in vp\<[[VEC_TC:%.+]]\> = vector-trip-count\nLive-in ir\<%n\> = original trip-count\n"]
12 ; CHECK-NEXT: node [shape=rect, fontname=Courier, fontsize=30]
13 ; CHECK-NEXT: edge [fontname=Courier, fontsize=30]
14 ; CHECK-NEXT: compound=true
15 ; CHECK-NEXT: N0 [label =
16 ; CHECK-NEXT: "ir-bb\<for.body.preheader\>:\l" +
17 ; CHECK-NEXT: "Successor(s): vector.ph\l"
19 ; CHECK-NEXT: N0 -> N1 [ label=""]
20 ; CHECK-NEXT: N1 [label =
21 ; CHECK-NEXT: "vector.ph:\l" +
22 ; CHECK-NEXT: "Successor(s): vector loop\l"
24 ; CHECK-NEXT: N1 -> N2 [ label="" lhead=cluster_N3]
25 ; CHECK-NEXT: subgraph cluster_N3 {
26 ; CHECK-NEXT: fontname=Courier
27 ; CHECK-NEXT: label="\<x1\> vector loop"
28 ; CHECK-NEXT: N2 [label =
29 ; CHECK-NEXT: "vector.body:\l" +
30 ; CHECK-NEXT: " EMIT vp\<[[CAN_IV:%.+]]\> = CANONICAL-INDUCTION ir\<0\>, vp\<[[CAN_IV_NEXT:%.+]]\>\l" +
31 ; CHECK-NEXT: " vp\<[[STEPS:%.+]]\> = SCALAR-STEPS vp\<[[CAN_IV]]\>, ir\<1\>\l" +
32 ; CHECK-NEXT: " CLONE ir\<%arrayidx\> = getelementptr inbounds ir\<%y\>, vp\<[[STEPS]]\>\l" +
33 ; CHECK-NEXT: " vp\<[[VEC_PTR:%.+]]\> = vector-pointer ir\<%arrayidx\>\l" +
34 ; CHECK-NEXT: " WIDEN ir\<%lv\> = load vp\<[[VEC_PTR]]\>\l" +
35 ; CHECK-NEXT: " WIDEN-INTRINSIC ir\<%call\> = call llvm.sqrt(ir\<%lv\>)\l" +
36 ; CHECK-NEXT: " CLONE ir\<%arrayidx2\> = getelementptr inbounds ir\<%x\>, vp\<[[STEPS]]\>\l" +
37 ; CHECK-NEXT: " vp\<[[VEC_PTR2:%.+]]\> = vector-pointer ir\<%arrayidx2\>\l" +
38 ; CHECK-NEXT: " WIDEN store vp\<[[VEC_PTR2]]\>, ir\<%call\>\l" +
39 ; CHECK-NEXT: " EMIT vp\<[[CAN_IV_NEXT]]\> = add nuw vp\<[[CAN_IV]]\>, vp\<[[VFxUF]]\>\l" +
40 ; CHECK-NEXT: " EMIT branch-on-count vp\<[[CAN_IV_NEXT]]\>, vp\<[[VEC_TC]]\>\l" +
41 ; CHECK-NEXT: "No successors\l"
45 %cmp6 = icmp sgt i64 %n, 0
46 br i1 %cmp6, label %for.body, label %for.end
48 for.body: ; preds = %entry, %for.body
49 %iv = phi i64 [ %iv.next, %for.body ], [ 0, %entry ]
50 %arrayidx = getelementptr inbounds float, ptr %y, i64 %iv
51 %lv = load float, ptr %arrayidx, align 4
52 %call = tail call float @llvm.sqrt.f32(float %lv) nounwind readnone
53 %arrayidx2 = getelementptr inbounds float, ptr %x, i64 %iv
54 store float %call, ptr %arrayidx2, align 4
55 %iv.next = add i64 %iv, 1
56 %exitcond = icmp eq i64 %iv.next, %n
57 br i1 %exitcond, label %for.end, label %for.body
59 for.end: ; preds = %for.body, %entry
63 declare float @llvm.sqrt.f32(float) nounwind readnone