• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt < %s -analyze -scalar-evolution | FileCheck %s
2
3@mode_table = global [4 x i32] zeroinitializer          ; <[4 x i32]*> [#uses=1]
4
5; CHECK: max backedge-taken count is 1{{$}}
6
7define i8 @f() {
8entry:
9  tail call i32 @fegetround( )          ; <i32>:0 [#uses=1]
10  br label %bb
11
12bb:             ; preds = %bb4, %entry
13  %mode.0 = phi i8 [ 0, %entry ], [ %indvar.next, %bb4 ]                ; <i8> [#uses=4]
14  zext i8 %mode.0 to i32                ; <i32>:1 [#uses=1]
15  getelementptr [4 x i32], [4 x i32]* @mode_table, i32 0, i32 %1           ; <i32*>:2 [#uses=1]
16  load i32, i32* %2, align 4         ; <i32>:3 [#uses=1]
17  icmp eq i32 %3, %0            ; <i1>:4 [#uses=1]
18  br i1 %4, label %bb1, label %bb2
19
20bb1:            ; preds = %bb
21  ret i8 %mode.0
22
23bb2:            ; preds = %bb
24  icmp eq i8 %mode.0, 1         ; <i1>:5 [#uses=1]
25  br i1 %5, label %bb5, label %bb4
26
27bb4:            ; preds = %bb2
28  %indvar.next = add i8 %mode.0, 1              ; <i8> [#uses=1]
29  br label %bb
30
31bb5:            ; preds = %bb2
32  tail call void @raise_exception( ) noreturn
33  unreachable
34}
35
36declare i32 @fegetround()
37
38declare void @raise_exception() noreturn
39