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 ; Single loop, not unswitched
28 ; LOOP1: Loop at depth 1 containing:
29 ; LOOP1-NOT: Loop at depth 1 containing:
33 define void @loop_simple5(i32* %addr, i1 %c1, i1 %c2, i1 %c3, i1 %c4, i1 %c5) {
37 %iv = phi i32 [0, %entry], [%iv.next, %loop_latch]
38 %iv.next = add i32 %iv, 1
39 ;; disabling trivial unswitch
41 br i1 %c1, label %loop_next1, label %exit
43 br i1 %c2, label %loop_next2, label %exit
45 br i1 %c3, label %loop_next3, label %exit
47 br i1 %c4, label %loop_next4, label %exit
49 br i1 %c5, label %loop_latch, label %exit
51 store volatile i32 0, i32* %addr
52 %test_loop = icmp slt i32 %iv, 50
53 br i1 %test_loop, label %loop, label %exit