2 ; Here all the branches are exiting ones. Checking that we dont have
3 ; exponential behavior with any kind of controlling heuristics here.
5 ; There we should have just a single loop.
7 ; RUN: opt < %s -enable-unswitch-cost-multiplier=true \
8 ; RUN: -unswitch-num-initial-unscaled-candidates=0 -unswitch-siblings-toplevel-div=1 \
9 ; RUN: -passes='loop(unswitch<nontrivial>),print<loops>' -disable-output 2>&1 | FileCheck %s --check-prefixes=LOOP1
11 ; RUN: opt < %s -enable-unswitch-cost-multiplier=true \
12 ; RUN: -unswitch-num-initial-unscaled-candidates=0 -unswitch-siblings-toplevel-div=8 \
13 ; RUN: -passes='loop(unswitch<nontrivial>),print<loops>' -disable-output 2>&1 | FileCheck %s --check-prefixes=LOOP1
15 ; RUN: opt < %s -enable-unswitch-cost-multiplier=true \
16 ; RUN: -unswitch-num-initial-unscaled-candidates=8 -unswitch-siblings-toplevel-div=1 \
17 ; RUN: -passes='loop(unswitch<nontrivial>),print<loops>' -disable-output 2>&1 | FileCheck %s --check-prefixes=LOOP1
19 ; RUN: opt < %s -enable-unswitch-cost-multiplier=true \
20 ; RUN: -unswitch-num-initial-unscaled-candidates=8 -unswitch-siblings-toplevel-div=8 \
21 ; RUN: -passes='loop(unswitch<nontrivial>),print<loops>' -disable-output 2>&1 | FileCheck %s --check-prefixes=LOOP1
23 ; RUN: opt < %s -enable-unswitch-cost-multiplier=false \
24 ; RUN: -passes='loop(unswitch<nontrivial>),print<loops>' -disable-output 2>&1 | FileCheck %s --check-prefixes=LOOP1
27 ; RUN: opt < %s -enable-unswitch-cost-multiplier=true \
28 ; RUN: -unswitch-num-initial-unscaled-candidates=0 -unswitch-siblings-toplevel-div=1 \
29 ; RUN: -passes='loop-mssa(unswitch<nontrivial>),print<loops>' -disable-output 2>&1 | FileCheck %s --check-prefixes=LOOP1
31 ; RUN: opt < %s -enable-unswitch-cost-multiplier=true \
32 ; RUN: -unswitch-num-initial-unscaled-candidates=0 -unswitch-siblings-toplevel-div=8 \
33 ; RUN: -passes='loop-mssa(unswitch<nontrivial>),print<loops>' -disable-output 2>&1 | FileCheck %s --check-prefixes=LOOP1
35 ; RUN: opt < %s -enable-unswitch-cost-multiplier=true \
36 ; RUN: -unswitch-num-initial-unscaled-candidates=8 -unswitch-siblings-toplevel-div=1 \
37 ; RUN: -passes='loop-mssa(unswitch<nontrivial>),print<loops>' -disable-output 2>&1 | FileCheck %s --check-prefixes=LOOP1
39 ; RUN: opt < %s -enable-unswitch-cost-multiplier=true \
40 ; RUN: -unswitch-num-initial-unscaled-candidates=8 -unswitch-siblings-toplevel-div=8 \
41 ; RUN: -passes='loop-mssa(unswitch<nontrivial>),print<loops>' -disable-output 2>&1 | FileCheck %s --check-prefixes=LOOP1
43 ; RUN: opt < %s -enable-unswitch-cost-multiplier=false \
44 ; RUN: -passes='loop-mssa(unswitch<nontrivial>),print<loops>' -disable-output 2>&1 | FileCheck %s --check-prefixes=LOOP1
47 ; Single loop, not unswitched
48 ; LOOP1: Loop at depth 1 containing:
49 ; LOOP1-NOT: Loop at depth 1 containing:
53 define void @loop_simple5(i32* %addr, i1 %c1, i1 %c2, i1 %c3, i1 %c4, i1 %c5) {
57 %iv = phi i32 [0, %entry], [%iv.next, %loop_latch]
58 %iv.next = add i32 %iv, 1
59 ;; disabling trivial unswitch
61 br i1 %c1, label %loop_next1, label %exit
63 br i1 %c2, label %loop_next2, label %exit
65 br i1 %c3, label %loop_next3, label %exit
67 br i1 %c4, label %loop_next4, label %exit
69 br i1 %c5, label %loop_latch, label %exit
71 store volatile i32 0, i32* %addr
72 %test_loop = icmp slt i32 %iv, 50
73 br i1 %test_loop, label %loop, label %exit