aboutsummaryrefslogtreecommitdiffstats
path: root/test/Transforms/SimplifyCFG/common-dest-folding.ll
blob: 10fb7d497de31572cc2533bf227972b7b463b0bd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
; RUN: opt < %s -simplifycfg -S | FileCheck %s

;CHECK: @foo
;CHECK: and i32 %c1, %k
;CHECK: icmp eq i32
;CHECK: and i32 %c2, %k
;CHECK: icmp eq i32
;CHECK: or i1
;CHECK: ret
define i32 @foo(i32 %k, i32 %c1, i32 %c2) {
  %1 = and i32 %c1, %k
  %2 = icmp eq i32 %1, 0
  br i1 %2, label %8, label %3

; <label>:3                                       ; preds = %0
  %4 = and i32 %c2, %k
  %5 = icmp eq i32 %4, 0
  br i1 %5, label %8, label %6

; <label>:6                                       ; preds = %3
  %7 = tail call i32 (...)* @bar() nounwind
  br label %8

; <label>:8                                       ; preds = %3, %0, %6
  ret i32 undef
}

declare i32 @bar(...)