xref: /llvm-project/llvm/test/Transforms/SimplifyCFG/2008-12-16-DCECond.ll (revision d1d129356909af2f6fefd6f1b9335a39fe172e9a)
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2; RUN: opt < %s -passes=simplifycfg -simplifycfg-require-and-preserve-domtree=1 -S -hoist-common-insts=true | FileCheck %s
3; ModuleID = '/tmp/x.bc'
4target 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-f80:128:128"
5target triple = "i686-pc-linux-gnu"
6
7define i32 @x(i32 %x) {
8; CHECK-LABEL: @x(
9; CHECK-NEXT:  entry:
10; CHECK-NEXT:    [[CALL:%.*]] = call i32 (...) @foo()
11; CHECK-NEXT:    [[CALL9:%.*]] = call i32 (...) @bar()
12; CHECK-NEXT:    ret i32 0
13;
14entry:
15  %cmp = icmp eq i32 %x, 8		; <i1> [#uses=1]
16  br i1 %cmp, label %ifthen, label %ifend
17
18ifthen:		; preds = %entry
19  %call = call i32 (...) @foo()		; <i32> [#uses=0]
20  br label %ifend
21
22ifend:		; preds = %ifthen, %entry
23  %cmp2 = icmp ne i32 %x, 8		; <i1> [#uses=1]
24  br i1 %cmp2, label %ifthen3, label %ifend5
25
26ifthen3:		; preds = %ifend
27  %call4 = call i32 (...) @foo()		; <i32> [#uses=0]
28  br label %ifend5
29
30ifend5:		; preds = %ifthen3, %ifend
31  %cmp7 = icmp eq i32 %x, 9		; <i1> [#uses=1]
32  br i1 %cmp7, label %ifthen8, label %ifend10
33
34ifthen8:		; preds = %ifend5
35  %call9 = call i32 (...) @bar()		; <i32> [#uses=0]
36  br label %ifend10
37
38ifend10:		; preds = %ifthen8, %ifend5
39  %cmp12 = icmp ne i32 %x, 9		; <i1> [#uses=1]
40  br i1 %cmp12, label %ifthen13, label %ifend15
41
42ifthen13:		; preds = %ifend10
43  %call14 = call i32 (...) @bar()		; <i32> [#uses=0]
44  br label %ifend15
45
46ifend15:		; preds = %ifthen13, %ifend10
47  ret i32 0
48}
49
50declare i32 @foo(...)
51
52declare i32 @bar(...)
53
54