~ubuntu-branches/ubuntu/quantal/llvm-3.1/quantal

« back to all changes in this revision

Viewing changes to test/CodeGen/X86/phi-immediate-factoring.ll

  • Committer: Package Import Robot
  • Author(s): Sylvestre Ledru
  • Date: 2012-03-29 19:09:51 UTC
  • Revision ID: package-import@ubuntu.com-20120329190951-aq83ivog4cg8bxun
Tags: upstream-3.1~svn153643
ImportĀ upstreamĀ versionĀ 3.1~svn153643

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
; RUN: llc < %s -march=x86 -stats |& grep {Number of blocks eliminated} | grep 6
 
2
; PR1296
 
3
 
 
4
target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64"
 
5
target triple = "i686-apple-darwin8"
 
6
 
 
7
define i32 @foo(i32 %A, i32 %B, i32 %C) nounwind {
 
8
entry:
 
9
        switch i32 %A, label %out [
 
10
                 i32 1, label %bb
 
11
                 i32 0, label %bb13
 
12
                 i32 2, label %bb35
 
13
        ]
 
14
 
 
15
bb:             ; preds = %cond_next, %entry
 
16
        %i.144.1 = phi i32 [ 0, %entry ], [ %tmp7, %cond_next ]         ; <i32> [#uses=2]
 
17
        %tmp4 = and i32 %i.144.1, %B            ; <i32> [#uses=1]
 
18
        icmp eq i32 %tmp4, 0            ; <i1>:0 [#uses=1]
 
19
        br i1 %0, label %cond_next, label %out
 
20
 
 
21
cond_next:              ; preds = %bb
 
22
        %tmp7 = add i32 %i.144.1, 1             ; <i32> [#uses=2]
 
23
        icmp slt i32 %tmp7, 1000                ; <i1>:1 [#uses=1]
 
24
        br i1 %1, label %bb, label %out
 
25
 
 
26
bb13:           ; preds = %cond_next18, %entry
 
27
        %i.248.1 = phi i32 [ 0, %entry ], [ %tmp20, %cond_next18 ]              ; <i32> [#uses=2]
 
28
        %tmp16 = and i32 %i.248.1, %C           ; <i32> [#uses=1]
 
29
        icmp eq i32 %tmp16, 0           ; <i1>:2 [#uses=1]
 
30
        br i1 %2, label %cond_next18, label %out
 
31
 
 
32
cond_next18:            ; preds = %bb13
 
33
        %tmp20 = add i32 %i.248.1, 1            ; <i32> [#uses=2]
 
34
        icmp slt i32 %tmp20, 1000               ; <i1>:3 [#uses=1]
 
35
        br i1 %3, label %bb13, label %out
 
36
 
 
37
bb27:           ; preds = %bb35
 
38
        %tmp30 = and i32 %i.3, %C               ; <i32> [#uses=1]
 
39
        icmp eq i32 %tmp30, 0           ; <i1>:4 [#uses=1]
 
40
        br i1 %4, label %cond_next32, label %out
 
41
 
 
42
cond_next32:            ; preds = %bb27
 
43
        %indvar.next = add i32 %i.3, 1          ; <i32> [#uses=1]
 
44
        br label %bb35
 
45
 
 
46
bb35:           ; preds = %entry, %cond_next32
 
47
        %i.3 = phi i32 [ %indvar.next, %cond_next32 ], [ 0, %entry ]            ; <i32> [#uses=3]
 
48
        icmp slt i32 %i.3, 1000         ; <i1>:5 [#uses=1]
 
49
        br i1 %5, label %bb27, label %out
 
50
 
 
51
out:            ; preds = %bb27, %bb35, %bb13, %cond_next18, %bb, %cond_next, %entry
 
52
        %result.0 = phi i32 [ 0, %entry ], [ 1, %bb ], [ 0, %cond_next ], [ 1, %bb13 ], [ 0, %cond_next18 ], [ 1, %bb27 ], [ 0, %bb35 ]         ; <i32> [#uses=1]
 
53
        ret i32 %result.0
 
54
}