1; RUN: llc -march=mipsel < %s | FileCheck %s
2
3@g0 = common global i32 0, align 4
4@g1 = common global i32 0, align 4
5
6; Check that LSR doesn't choose a solution with a formula "reg + 4*reg".
7;
8; CHECK:      $BB0_2:
9; CHECK-NOT:  sll ${{[0-9]+}}, ${{[0-9]+}}, 2
10
11define i32 @f0(i32 %n, i32 %m, [256 x i32]* nocapture %a, [256 x i32]* nocapture %b) nounwind readonly {
12entry:
13  br label %for.cond1.preheader
14
15for.cond1.preheader:
16  %s.022 = phi i32 [ 0, %entry ], [ %add7, %for.inc9 ]
17  %i.021 = phi i32 [ 0, %entry ], [ %add10, %for.inc9 ]
18  br label %for.body3
19
20for.body3:
21  %s.120 = phi i32 [ %s.022, %for.cond1.preheader ], [ %add7, %for.body3 ]
22  %j.019 = phi i32 [ 0, %for.cond1.preheader ], [ %add8, %for.body3 ]
23  %arrayidx4 = getelementptr inbounds [256 x i32], [256 x i32]* %a, i32 %i.021, i32 %j.019
24  %0 = load i32, i32* %arrayidx4, align 4
25  %arrayidx6 = getelementptr inbounds [256 x i32], [256 x i32]* %b, i32 %i.021, i32 %j.019
26  %1 = load i32, i32* %arrayidx6, align 4
27  %add = add i32 %0, %s.120
28  %add7 = add i32 %add, %1
29  %add8 = add nsw i32 %j.019, %m
30  %cmp2 = icmp slt i32 %add8, 64
31  br i1 %cmp2, label %for.body3, label %for.inc9
32
33for.inc9:
34  %add10 = add nsw i32 %i.021, %n
35  %cmp = icmp slt i32 %add10, 64
36  br i1 %cmp, label %for.cond1.preheader, label %for.end11
37
38for.end11:
39  ret i32 %add7
40}
41
42