[DAGCombiner] Add target hook function to decide folding (mul (add x, c1), c2)
[llvm-project.git] / llvm / test / Transforms / NewGVN / phi-edge-handling.ll
blob4ac78a557061bc35ee189908a6bebb5dcc70cab6
1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -newgvn -S | FileCheck %s
5 ;; Block 6 is reachable, but edge 6->4 is not
6 ;; This means the phi value is undef, not 0
7 ; Function Attrs: ssp uwtable
8 define i16 @hoge() local_unnamed_addr #0 align 2 {
9 ; CHECK-LABEL: @hoge(
10 ; CHECK-NEXT:  bb:
11 ; CHECK-NEXT:    switch i8 undef, label [[BB7:%.*]] [
12 ; CHECK-NEXT:    i8 0, label [[BB1:%.*]]
13 ; CHECK-NEXT:    i8 12, label [[BB2:%.*]]
14 ; CHECK-NEXT:    ]
15 ; CHECK:       bb1:
16 ; CHECK-NEXT:    br label [[BB6:%.*]]
17 ; CHECK:       bb2:
18 ; CHECK-NEXT:    br label [[BB4:%.*]]
19 ; CHECK:       bb3:
20 ; CHECK-NEXT:    unreachable
21 ; CHECK:       bb4:
22 ; CHECK-NEXT:    ret i16 undef
23 ; CHECK:       bb6:
24 ; CHECK-NEXT:    br i1 true, label [[BB3:%.*]], label [[BB4]], !llvm.loop !1
25 ; CHECK:       bb7:
26 ; CHECK-NEXT:    unreachable
28 bb:
29   switch i8 undef, label %bb7 [
30   i8 0, label %bb1
31   i8 12, label %bb2
32   ]
34 bb1:                                              ; preds = %bb
35   br label %bb6
37 bb2:                                              ; preds = %bb
38   br label %bb4
40 bb3:                                              ; preds = %bb6
41   unreachable
43 bb4:                                              ; preds = %bb6, %bb2
44   %tmp = phi i16 [ 0, %bb6 ], [ undef, %bb2 ]
45   ret i16 %tmp
47 bb6:                                              ; preds = %bb4
48   br i1 true, label %bb3, label %bb4, !llvm.loop !1
50 bb7:                                              ; preds = %bb
51   unreachable
54 attributes #0 = { ssp uwtable "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="penryn" "target-features"="+cx16,+fxsr,+mmx,+sse,+sse2,+sse3,+sse4.1,+ssse3,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
56 !llvm.ident = !{!0}
58 !0 = !{!"clang version 5.0.0"}
59 !1 = distinct !{!1, !2}
60 !2 = !{!"llvm.loop.unroll.disable"}