aboutsummaryrefslogtreecommitdiff
path: root/llvm/test/Transforms/SimpleLoopUnswitch/nontrivial-unswitch-redundant-switch.ll
blob: b32e2dcd69501238d35ee237dcd1e292c4eab5eb (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
; REQUIRES: asserts
; RUN: opt -passes='simple-loop-unswitch<nontrivial>' -disable-output -S < %s
; RUN: opt -passes='loop-mssa(simple-loop-unswitch<nontrivial>)' -disable-output -S < %s

; This loop shouldn't trigger asserts in SimpleLoopUnswitch.
define void @test_redundant_switch(ptr %ptr, i32 %cond) {
entry:
  br label %loop_begin

loop_begin:
  switch i32 %cond, label %loop_body [
      i32 0, label %loop_body
  ]

loop_body:
  br label %loop_latch

loop_latch:
  %v = load i1, ptr %ptr
  br i1 %v, label %loop_begin, label %loop_exit

loop_exit:
  ret void
}