blob: 261c3cceed6d6a54abfedc2f89adb8c273c005cb [file] [log] [blame]
Eric Christophercee313d2019-04-17 04:52:47 +00001; RUN: llc -mtriple=armv8-eabi -verify-machineinstrs %s -o /dev/null
2
3; This test ensures that Loop Strength Reduction will
4; not create an Add Reccurence Expression if not all
5; its operands are loop invariants.
6
7define void @add_rec_expr() {
8entry:
9 br label %loop0
10
11loop0:
12 %c.0 = phi i32 [ 0, %entry ], [ %inc.0, %loop0 ]
13 %inc.0 = add nuw i32 %c.0, 1
14 br i1 undef, label %loop0, label %bb1
15
16bb1:
17 %mul.0 = mul i32 %c.0, %c.0
18 %gelptr.0 = getelementptr inbounds i16, i16* undef, i32 %mul.0
19 br label %loop1
20
21loop1:
22 %inc.1 = phi i32 [ %inc.2, %bb4 ], [ 0, %bb1 ]
23 %mul.1 = mul i32 %inc.1, %c.0
24 br label %bb3
25
26bb3:
27 %add.0 = add i32 undef, %mul.1
28 %gelptr.1 = getelementptr inbounds i16, i16* %gelptr.0, i32 %add.0
29 store i16 undef, i16* %gelptr.1, align 2
30 br label %bb4
31
32bb4:
33 %inc.2 = add nuw i32 %inc.1, 1
34 br label %loop1
35}