summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms/GVNHoist/hoist-more-than-two-branches.ll
blob: 58864ad4e3fc239dd1a6a6b6fafce1e22f7e0df0 (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
29
30
31
; RUN: opt -gvn-hoist -S < %s | FileCheck %s

; CHECK: store
; CHECK-NOT: store

; Check that an instruction can be hoisted to a basic block
; with more than two successors.

@G = external global i32, align 4

define void @foo(i32 %c1) {
entry:
  switch i32 %c1, label %exit1 [
    i32 0, label %sw0
    i32 1, label %sw1
  ]

sw0:
  store i32 1, i32* @G
  br label %exit

sw1:
  store i32 1, i32* @G
  br label %exit

exit1:
  store i32 1, i32* @G
  ret void
exit:
  ret void
}
OpenPOWER on IntegriCloud