1 ; RUN: llc -march=hexagon -hexagon-initial-cfg-cleanup=0 -enable-pipeliner -pipeliner-max-stages=2 < %s -pipeliner-experimental-cg=true | FileCheck %s
3 ; Check that the pipelined code uses the proper address in the
4 ; prolog and the kernel. The bug occurs when the address computation
5 ; computes the same value twice.
7 ; CHECK: = addasl(r{{[0-9]+}},[[REG0:(r[0-9]+)]],#1)
8 ; CHECK-NOT: = addasl(r{{[0-9]+}},[[REG0]],#1)
10 ; Function Attrs: nounwind
11 define void @f0(i32 %a0, ptr nocapture %a1) #0 {
13 br i1 undef, label %b2, label %b1
21 b3: ; preds = %b4, %b2
22 br i1 undef, label %b4, label %b5
28 br i1 undef, label %b6, label %b7
34 br i1 undef, label %b8, label %b12
37 br i1 undef, label %b9, label %b11
39 b9: ; preds = %b9, %b8
40 br i1 undef, label %b9, label %b10
43 br i1 undef, label %b12, label %b11
45 b11: ; preds = %b11, %b10, %b8
46 %v0 = phi i32 [ %v6, %b11 ], [ undef, %b8 ], [ undef, %b10 ]
47 %v1 = phi i32 [ %v0, %b11 ], [ %a0, %b8 ], [ undef, %b10 ]
48 %v2 = add nsw i32 %v1, -2
49 %v3 = getelementptr inbounds i16, ptr %a1, i32 %v2
50 %v4 = load i16, ptr %v3, align 2, !tbaa !0
51 %v5 = getelementptr inbounds i16, ptr %a1, i32 %v0
52 store i16 %v4, ptr %v5, align 2, !tbaa !0
53 %v6 = add nsw i32 %v0, -1
54 %v7 = icmp sgt i32 %v6, 0
55 br i1 %v7, label %b11, label %b12
57 b12: ; preds = %b11, %b10, %b7
61 attributes #0 = { nounwind "target-cpu"="hexagonv55" }
65 !2 = !{!"omnipotent char", !3}
66 !3 = !{!"Simple C/C++ TBAA"}