aboutsummaryrefslogtreecommitdiff
path: root/test/Analysis/ScalarEvolution/trip-count6.ll
blob: a6674092e7995797055acddb29ee70ff63420935 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
; RUN: llvm-as < %s | opt -analyze -disable-output -scalar-evolution \
; RUN:  | grep {max backedge-taken count is 1\$}

@mode_table = global [4 x i32] zeroinitializer          ; <[4 x i32]*> [#uses=1]

define i8 @f() {
entry:
  tail call i32 @fegetround( )          ; <i32>:0 [#uses=1]
  br label %bb

bb:             ; preds = %bb4, %entry
  %mode.0 = phi i8 [ 0, %entry ], [ %indvar.next, %bb4 ]                ; <i8> [#uses=4]
  zext i8 %mode.0 to i32                ; <i32>:1 [#uses=1]
  getelementptr [4 x i32]* @mode_table, i32 0, i32 %1           ; <i32*>:2 [#uses=1]
  load i32* %2, align 4         ; <i32>:3 [#uses=1]
  icmp eq i32 %3, %0            ; <i1>:4 [#uses=1]
  br i1 %4, label %bb1, label %bb2

bb1:            ; preds = %bb
  ret i8 %mode.0

bb2:            ; preds = %bb
  icmp eq i8 %mode.0, 1         ; <i1>:5 [#uses=1]
  br i1 %5, label %bb5, label %bb4

bb4:            ; preds = %bb2
  %indvar.next = add i8 %mode.0, 1              ; <i8> [#uses=1]
  br label %bb

bb5:            ; preds = %bb2
  tail call void @raise_exception( ) noreturn 
  unreachable
}

declare i32 @fegetround()

declare void @raise_exception() noreturn