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

« back to all changes in this revision

Viewing changes to test/Transforms/JumpThreading/and-and-cond.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: opt < %s -jump-threading -mem2reg -instcombine -simplifycfg  -S | FileCheck %s
 
2
 
 
3
declare i32 @f1()
 
4
declare i32 @f2()
 
5
declare void @f3()
 
6
 
 
7
define i32 @test(i1 %cond, i1 %cond2, i1 %cond3) {
 
8
; CHECK: test
 
9
        br i1 %cond, label %T1, label %F1
 
10
 
 
11
; CHECK-NOT: T1:
 
12
T1:
 
13
        %v1 = call i32 @f1()
 
14
        br label %Merge
 
15
 
 
16
F1:
 
17
        %v2 = call i32 @f2()
 
18
        br label %Merge
 
19
 
 
20
Merge:
 
21
; CHECK: Merge:
 
22
; CHECK: %v1 = call i32 @f1()
 
23
; CHECK-NEXT: %D = and i1 %cond2, %cond3
 
24
; CHECK-NEXT: br i1 %D
 
25
        %A = phi i1 [true, %T1], [false, %F1]
 
26
        %B = phi i32 [%v1, %T1], [%v2, %F1]
 
27
        %C = and i1 %A, %cond2
 
28
        %D = and i1 %C, %cond3
 
29
        br i1 %D, label %T2, label %F2
 
30
 
 
31
T2:
 
32
        call void @f3()
 
33
        ret i32 %B
 
34
 
 
35
F2:
 
36
        ret i32 %B
 
37
}