• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt -loop-reduce -S < %s | FileCheck %s
2;
3; Test LSR's use of SplitCriticalEdge during phi rewriting.
4; Verify that identical edges are merged. rdar://problem/6453893
5
6target triple = "x86-apple-darwin"
7
8; CHECK: @test
9; CHECK: bb89:
10; CHECK: phi i8* [ %lsr.iv.next1, %bbA.bb89_crit_edge ], [ %lsr.iv.next1, %bbB.bb89_crit_edge ]{{$}}
11
12define i8* @test() {
13entry:
14  br label %loop
15
16loop:
17  %rec = phi i32 [ %next, %loop ], [ 0, %entry ]
18  %next = add i32 %rec, 1
19  %tmp75 = getelementptr i8* null, i32 %next
20  br i1 false, label %loop, label %loopexit
21
22loopexit:
23  br i1 false, label %bbA, label %bbB
24
25bbA:
26  switch i32 0, label %bb89 [
27    i32 47, label %bb89
28    i32 58, label %bb89
29  ]
30
31bbB:
32  switch i8 0, label %bb89 [
33    i8 47, label %bb89
34    i8 58, label %bb89
35  ]
36
37bb89:
38  %tmp75phi = phi i8* [ %tmp75, %bbA ], [ %tmp75, %bbA ], [ %tmp75, %bbA ], [ %tmp75, %bbB ], [ %tmp75, %bbB ], [ %tmp75, %bbB ]
39  br label %exit
40
41exit:
42  ret i8* %tmp75phi
43}
44