~pali/+junk/llvm-toolchain-3.7

« back to all changes in this revision

Viewing changes to test/Transforms/IndVarSimplify/eliminate-max.ll

  • Committer: Package Import Robot
  • Author(s): Sylvestre Ledru
  • Date: 2015-07-15 17:51:08 UTC
  • Revision ID: package-import@ubuntu.com-20150715175108-l8mynwovkx4zx697
Tags: upstream-3.7~+rc2
ImportĀ upstreamĀ versionĀ 3.7~+rc2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
; RUN: opt < %s -S -indvars | grep "= icmp" | count 3
 
2
; PR4914.ll
 
3
 
 
4
; Indvars should be able to do range analysis and eliminate icmps.
 
5
; There are two here which cannot be eliminated.
 
6
; There's one that icmp which can be eliminated and which indvars currently
 
7
; cannot eliminate, because it requires analyzing more than just the
 
8
; range of the induction variable.
 
9
 
 
10
@0 = private constant [4 x i8] c"%d\0A\00", align 1 ; <[4 x i8]*> [#uses=1]
 
11
 
 
12
define i32 @main() nounwind {
 
13
bb:
 
14
  br label %bb1
 
15
 
 
16
bb1:                                              ; preds = %bb14, %bb
 
17
  %t = phi i32 [ 0, %bb ], [ %t19, %bb14 ]        ; <i32> [#uses=5]
 
18
  %t2 = phi i32 [ 0, %bb ], [ %t18, %bb14 ]       ; <i32> [#uses=1]
 
19
  %t3 = icmp slt i32 %t, 0                        ; <i1> [#uses=1]
 
20
  br i1 %t3, label %bb7, label %bb4
 
21
 
 
22
bb4:                                              ; preds = %bb1
 
23
  %t5 = icmp sgt i32 %t, 255                      ; <i1> [#uses=1]
 
24
  %t6 = select i1 %t5, i32 255, i32 %t            ; <i32> [#uses=1]
 
25
  br label %bb7
 
26
 
 
27
bb7:                                              ; preds = %bb4, %bb1
 
28
  %t8 = phi i32 [ %t6, %bb4 ], [ 0, %bb1 ]        ; <i32> [#uses=1]
 
29
  %t9 = sub i32 0, %t                             ; <i32> [#uses=3]
 
30
  %t10 = icmp slt i32 %t9, 0                      ; <i1> [#uses=1]
 
31
  br i1 %t10, label %bb14, label %bb11
 
32
 
 
33
bb11:                                             ; preds = %bb7
 
34
  %t12 = icmp sgt i32 %t9, 255                    ; <i1> [#uses=1]
 
35
  %t13 = select i1 %t12, i32 255, i32 %t9         ; <i32> [#uses=1]
 
36
  br label %bb14
 
37
 
 
38
bb14:                                             ; preds = %bb11, %bb7
 
39
  %t15 = phi i32 [ %t13, %bb11 ], [ 0, %bb7 ]     ; <i32> [#uses=1]
 
40
  %t16 = add nsw i32 %t2, 255                     ; <i32> [#uses=1]
 
41
  %t17 = add nsw i32 %t16, %t8                    ; <i32> [#uses=1]
 
42
  %t18 = add nsw i32 %t17, %t15                   ; <i32> [#uses=2]
 
43
  %t19 = add nsw i32 %t, 1                        ; <i32> [#uses=2]
 
44
  %t20 = icmp slt i32 %t19, 1000000000            ; <i1> [#uses=1]
 
45
  br i1 %t20, label %bb1, label %bb21
 
46
 
 
47
bb21:                                             ; preds = %bb14
 
48
  %t22 = call i32 (i8*, ...) @printf(i8* noalias getelementptr inbounds ([4 x i8], [4 x i8]* @0, i32 0, i32 0), i32 %t18) nounwind
 
49
  ret i32 0
 
50
}
 
51
 
 
52
declare i32 @printf(i8* noalias nocapture, ...) nounwind