1; RUN: opt %loadPolly -S -polly-codegen < %s
2;
3; Excerpt from the test-suite's oggenc reduced using bugpoint.
4;
5; It features a SCEV value using %div44 for the inner loop (for.body.51 =>
6; for.cond.60.preheader) that is computed within the body of the outer loop
7; (for.cond.30.preheader => for.cond.60.preheader). CodeGenerator would add a
8; computation of the SCEV to before the scop that references %div44, which is
9; not available then.
10;
11; CHECK:      polly.split_new_and_old:
12; CHECK-NEXT:   %div23.neg.polly.copy = sdiv i64 0, -4
13;
14target triple = "x86_64-unknown-linux-gnu"
15
16define void @_vorbis_apply_window(float* %d) {
17entry:
18  %0 = load float*, float** undef, align 8
19  %div23.neg = sdiv i64 0, -4
20  %sub24 = add i64 0, %div23.neg
21  br label %for.cond.30.preheader
22
23for.cond.30.preheader:                            ; preds = %for.body, %entry
24  %sext = shl i64 %sub24, 32
25  %conv48.74 = ashr exact i64 %sext, 32
26  %cmp49.75 = icmp slt i64 %conv48.74, 0
27  br i1 %cmp49.75, label %for.body.51.lr.ph, label %for.cond.60.preheader
28
29for.body.51.lr.ph:                                ; preds = %for.cond.30.preheader
30  %div44 = sdiv i64 0, 2
31  %sub45 = add nsw i64 %div44, 4294967295
32  %1 = trunc i64 %sub45 to i32
33  %2 = sext i32 %1 to i64
34  br label %for.body.51
35
36for.cond.60.preheader:                            ; preds = %for.body.51, %for.cond.30.preheader
37  ret void
38
39for.body.51:                                      ; preds = %for.body.51, %for.body.51.lr.ph
40  %indvars.iv86 = phi i64 [ %2, %for.body.51.lr.ph ], [ undef, %for.body.51 ]
41  %arrayidx53 = getelementptr inbounds float, float* %0, i64 %indvars.iv86
42  %3 = load float, float* %arrayidx53, align 4
43  %arrayidx55 = getelementptr inbounds float, float* %d, i64 0
44  %mul56 = fmul float %3, undef
45  store float %mul56, float* %arrayidx55, align 4
46  br i1 false, label %for.body.51, label %for.cond.60.preheader
47}
48