1; RUN: opt %loadPolly -polly-codegen -S < %s | FileCheck %s
2
3; PR25241 (https://llvm.org/bugs/show_bug.cgi?id=25241)
4; Ensure that synthesized values of a PHI node argument are generated in the
5; incoming block, not in the PHI's block.
6
7; CHECK-LABEL: polly.stmt.if.then.862:
8; CHECK:         %[[R1:[0-9]+]] = add i32 %tmp, 1
9; CHECK:         br label
10
11; CHECK-LABEL: polly.stmt.while.body.740.region_exiting:
12; CHECK:         %polly.curr.3 = phi i32 [ %[[R1]], %polly.stmt.if.then.862 ], [ undef, %polly.stmt.if.else.864 ]
13; CHECK:         br label %polly.stmt.polly.merge_new_and_old.exit
14
15; CHECK-LABEL: polly.stmt.polly.merge_new_and_old.exit:
16; CHECK:         store i32 %polly.curr.3, i32* %curr.3.s2a
17; CHECK:         br label %polly.exiting
18
19; CHECK-LABEL: polly.exiting:
20; CHECK:         %curr.3.ph.final_reload = load i32, i32* %curr.3.s2a
21; CHECK:         br label
22
23
24target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
25target triple = "x86_64-unknown-linux-gnu"
26
27; Function Attrs: nounwind uwtable
28define void @BZ2_decompress() #0 {
29entry:
30  %tmp = load i32, i32* undef, align 4, !tbaa !1
31  switch i32 undef, label %save_state_and_return [
32    i32 34, label %sw.bb.748
33    i32 35, label %if.then.813
34  ]
35
36while.body.740:                                   ; preds = %if.else.864, %if.then.862
37  %curr.3 = phi i32 [ %inc863, %if.then.862 ], [ undef, %if.else.864 ]
38  ret void
39
40sw.bb.748:                                        ; preds = %entry
41  ret void
42
43if.then.813:                                      ; preds = %entry
44  %conv823903 = and i32 undef, undef
45  %cmp860 = icmp eq i32 %conv823903, 0
46  br i1 %cmp860, label %if.then.862, label %if.else.864
47
48if.then.862:                                      ; preds = %if.then.813
49  %inc863 = add nsw i32 %tmp, 1
50  br label %while.body.740
51
52if.else.864:                                      ; preds = %if.then.813
53  br label %while.body.740
54
55save_state_and_return:                            ; preds = %entry
56  ret void
57}
58
59attributes #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" }
60
61!llvm.ident = !{!0}
62
63!0 = !{!"clang version 3.8.0 (trunk 250010) (llvm/trunk 250018)"}
64!1 = !{!2, !6, i64 64092}
65!2 = !{!"", !3, i64 0, !6, i64 8, !4, i64 12, !6, i64 16, !4, i64 20, !6, i64 24, !6, i64 28, !6, i64 32, !6, i64 36, !6, i64 40, !4, i64 44, !6, i64 48, !6, i64 52, !6, i64 56, !6, i64 60, !6, i64 64, !4, i64 68, !6, i64 1092, !4, i64 1096, !4, i64 2124, !3, i64 3152, !3, i64 3160, !3, i64 3168, !6, i64 3176, !6, i64 3180, !6, i64 3184, !6, i64 3188, !6, i64 3192, !4, i64 3196, !4, i64 3452, !4, i64 3468, !4, i64 3724, !4, i64 7820, !4, i64 7884, !4, i64 25886, !4, i64 43888, !4, i64 45436, !4, i64 51628, !4, i64 57820, !4, i64 64012, !6, i64 64036, !6, i64 64040, !6, i64 64044, !6, i64 64048, !6, i64 64052, !6, i64 64056, !6, i64 64060, !6, i64 64064, !6, i64 64068, !6, i64 64072, !6, i64 64076, !6, i64 64080, !6, i64 64084, !6, i64 64088, !6, i64 64092, !6, i64 64096, !6, i64 64100, !6, i64 64104, !6, i64 64108, !6, i64 64112, !6, i64 64116, !3, i64 64120, !3, i64 64128, !3, i64 64136}
66!3 = !{!"any pointer", !4, i64 0}
67!4 = !{!"omnipotent char", !5, i64 0}
68!5 = !{!"Simple C/C++ TBAA"}
69!6 = !{!"int", !4, i64 0}
70