• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt %loadPolly -polly-codegen -S \
2; RUN: -polly-invariant-load-hoisting=true < %s | FileCheck %s
3
4; bugpoint-reduced testcase of MiBench/consumer-lame/quantize-pvt.c from the
5; test-suite.
6; It features a SCEV that is used in two BasicBlock within a non-affine
7; subregion where none of the blocks dominate the other. We check that the SCEV
8; is expanded independently for both BasicBlocks instead of just once for the
9; whole subregion.
10
11; CHECK-LABEL:  polly.stmt.if.then.110:
12; CHECK:          %[[R1_1:[0-9]*]] = mul nuw nsw i64 %polly.indvar[[R0_1:[0-9]*]], 30
13; CHECK:          %scevgep[[R1_2:[0-9]*]] = getelementptr i32, i32* %scevgep{{[0-9]*}}, i64 %[[R1_1]]
14; CHECK:          store i32 0, i32* %scevgep[[R1_2]], align 8
15
16; CHECK-LABEL:  polly.stmt.if.else:
17; CHECK:          %[[R2_1:[0-9]*]] = mul nuw nsw i64 %polly.indvar[[R0_1]], 30
18; CHECK:          %scevgep[[R2_2:[0-9]*]] = getelementptr i32, i32* %scevgep{{[0-9]*}}, i64 %[[R2_1]]
19; CHECK:          store i32 21, i32* %scevgep[[R2_2]], align 8
20
21target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
22target triple = "x86_64-unknown-linux-gnu"
23
24%struct.gr_info.4.59.136.224.290 = type { i32, i32, i32, i32, i32, i32, i32, i32, [3 x i32], [3 x i32], i32, i32, i32, i32, i32, i32, i32, i32, i32, i32*, [4 x i32] }
25%struct.gr_info_ss.5.60.137.225.291 = type { %struct.gr_info.4.59.136.224.290 }
26%struct.anon.6.61.138.226.292 = type { [2 x %struct.gr_info_ss.5.60.137.225.291] }
27%struct.III_side_info_t.7.62.139.227.293 = type { i32, i32, i32, [2 x [4 x i32]], [2 x %struct.anon.6.61.138.226.292] }
28%struct.lame_global_flags.3.58.135.223.289 = type { i64, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i8*, i8*, i32, i32, float, i32, i32, i32, i64, i64, i32, i32, i32, i32, i32, i32, i32, i32, float, i32, i32, i32, float, float, float, float, i32, i32, i32, i32, i32, i32, i32, i32 }
29
30@convert_mdct = external global i32, align 4
31@reduce_sidechannel = external global i32, align 4
32
33; Function Attrs: nounwind uwtable
34define void @iteration_init(%struct.lame_global_flags.3.58.135.223.289* %gfp, %struct.III_side_info_t.7.62.139.227.293* %l3_side, [2 x [576 x i32]]* %l3_enc) #0 {
35entry:
36  %resvDrain = getelementptr inbounds %struct.III_side_info_t.7.62.139.227.293, %struct.III_side_info_t.7.62.139.227.293* %l3_side, i64 0, i32 2
37  store i32 0, i32* %resvDrain, align 8
38  store i32 0, i32* @convert_mdct, align 4
39  store i32 0, i32* @reduce_sidechannel, align 4
40  %mode_gr = getelementptr inbounds %struct.lame_global_flags.3.58.135.223.289, %struct.lame_global_flags.3.58.135.223.289* %gfp, i64 0, i32 45
41  %0 = load i32, i32* %mode_gr, align 8
42  %cmp95.145 = icmp sgt i32 %0, 0
43  br i1 %cmp95.145, label %for.cond.98.preheader, label %for.cond.120.preheader
44
45for.cond.98.preheader:                            ; preds = %for.inc.117, %entry
46  %indvars.iv157 = phi i64 [ %indvars.iv.next158, %for.inc.117 ], [ 0, %entry ]
47  %stereo = getelementptr inbounds %struct.lame_global_flags.3.58.135.223.289, %struct.lame_global_flags.3.58.135.223.289* %gfp, i64 0, i32 46
48  %1 = load i32, i32* %stereo, align 4
49  %cmp99.143 = icmp sgt i32 %1, 0
50  br i1 %cmp99.143, label %for.body.101, label %for.inc.117
51
52for.cond.120.preheader:                           ; preds = %for.inc.117, %entry
53  ret void
54
55for.body.101:                                     ; preds = %for.inc.114, %for.cond.98.preheader
56  %indvars.iv155 = phi i64 [ %indvars.iv.next156, %for.inc.114 ], [ 0, %for.cond.98.preheader ]
57  %block_type = getelementptr inbounds %struct.III_side_info_t.7.62.139.227.293, %struct.III_side_info_t.7.62.139.227.293* %l3_side, i64 0, i32 4, i64 %indvars.iv157, i32 0, i64 %indvars.iv155, i32 0, i32 6
58  %2 = load i32, i32* %block_type, align 8
59  %cmp108 = icmp eq i32 %2, 2
60  %sfb_lmax = getelementptr inbounds %struct.III_side_info_t.7.62.139.227.293, %struct.III_side_info_t.7.62.139.227.293* %l3_side, i64 0, i32 4, i64 %indvars.iv157, i32 0, i64 %indvars.iv155, i32 0, i32 16
61  br i1 %cmp108, label %if.then.110, label %if.else
62
63if.then.110:                                      ; preds = %for.body.101
64  store i32 0, i32* %sfb_lmax, align 8
65  %sfb_smax = getelementptr inbounds %struct.III_side_info_t.7.62.139.227.293, %struct.III_side_info_t.7.62.139.227.293* %l3_side, i64 0, i32 4, i64 %indvars.iv157, i32 0, i64 %indvars.iv155, i32 0, i32 17
66  store i32 0, i32* %sfb_smax, align 4
67  br label %for.inc.114
68
69if.else:                                          ; preds = %for.body.101
70  store i32 21, i32* %sfb_lmax, align 8
71  %sfb_smax112 = getelementptr inbounds %struct.III_side_info_t.7.62.139.227.293, %struct.III_side_info_t.7.62.139.227.293* %l3_side, i64 0, i32 4, i64 %indvars.iv157, i32 0, i64 %indvars.iv155, i32 0, i32 17
72  store i32 12, i32* %sfb_smax112, align 4
73  br label %for.inc.114
74
75for.inc.114:                                      ; preds = %if.else, %if.then.110
76  %indvars.iv.next156 = add nuw nsw i64 %indvars.iv155, 1
77  %3 = load i32, i32* %stereo, align 4
78  %4 = sext i32 %3 to i64
79  %cmp99 = icmp slt i64 %indvars.iv.next156, %4
80  br i1 %cmp99, label %for.body.101, label %for.inc.117
81
82for.inc.117:                                      ; preds = %for.inc.114, %for.cond.98.preheader
83  %indvars.iv.next158 = add nuw nsw i64 %indvars.iv157, 1
84  %5 = load i32, i32* %mode_gr, align 8
85  %6 = sext i32 %5 to i64
86  %cmp95 = icmp slt i64 %indvars.iv.next158, %6
87  br i1 %cmp95, label %for.cond.98.preheader, label %for.cond.120.preheader
88}
89
90attributes #0 = { nounwind uwtable "disable-tail-calls"="false" "less-precise-fpmad"="false" "frame-pointer"="none" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+mmx,+sse,+sse2" "unsafe-fp-math"="false" "use-soft-float"="false" }
91