2 ; There should be just a single copy of loop when strictest mutiplier candidates
3 ; formula (unscaled candidates == 0) is enforced:
5 ; RUN: opt < %s -enable-unswitch-cost-multiplier=true \
6 ; RUN: -unswitch-num-initial-unscaled-candidates=0 -unswitch-siblings-toplevel-div=1 \
7 ; RUN: -passes='loop(unswitch<nontrivial>),print<loops>' -disable-output 2>&1 | FileCheck %s --check-prefixes=LOOP1
9 ; RUN: opt < %s -enable-unswitch-cost-multiplier=true \
10 ; RUN: -unswitch-num-initial-unscaled-candidates=0 -unswitch-siblings-toplevel-div=8 \
11 ; RUN: -passes='loop(unswitch<nontrivial>),print<loops>' -disable-output 2>&1 | FileCheck %s --check-prefixes=LOOP1
13 ; With relaxed candidates multiplier (unscaled candidates == 8) we should allow
14 ; some unswitches to happen until siblings multiplier starts kicking in:
16 ; RUN: opt < %s -enable-unswitch-cost-multiplier=true \
17 ; RUN: -unswitch-num-initial-unscaled-candidates=8 -unswitch-siblings-toplevel-div=1 \
18 ; RUN: -passes='loop(unswitch<nontrivial>),print<loops>' -disable-output 2>&1 | FileCheck %s --check-prefixes=LOOP5
20 ; With relaxed candidates multiplier (unscaled candidates == 8) and with relaxed
21 ; siblings multiplier for top-level loops (toplevel-div == 8) we should get
22 ; 2^(num conds) == 2^5 == 32
25 ; RUN: opt < %s -enable-unswitch-cost-multiplier=true \
26 ; RUN: -unswitch-num-initial-unscaled-candidates=8 -unswitch-siblings-toplevel-div=8 \
27 ; RUN: -passes='loop(unswitch<nontrivial>),print<loops>' -disable-output 2>&1 | FileCheck %s --check-prefixes=LOOP32
30 ; 2^(num conds) == 2^5 == 32
31 ; copies of the loop when cost multiplier is disabled:
33 ; RUN: opt < %s -enable-unswitch-cost-multiplier=false \
34 ; RUN: -passes='loop(unswitch<nontrivial>),print<loops>' -disable-output 2>&1 | FileCheck %s --check-prefixes=LOOP32
37 ; Single loop, not unswitched
38 ; LOOP1: Loop at depth 1 containing:
39 ; LOOP1-NOT: Loop at depth 1 containing:
41 ; 5 loops, unswitched 4 times
42 ; LOOP5-COUNT-5: Loop at depth 1 containing:
43 ; LOOP5-NOT: Loop at depth 1 containing:
45 ; 32 loops, fully unswitched
46 ; LOOP32-COUNT-32: Loop at depth 1 containing:
47 ; LOOP32-NOT: Loop at depth 1 containing:
49 define void @loop_simple5(i32* %addr, i1 %c1, i1 %c2, i1 %c3, i1 %c4, i1 %c5) {
53 %iv = phi i32 [0, %entry], [%iv.next, %loop_latch]
54 %iv.next = add i32 %iv, 1
55 br i1 %c1, label %loop_next1, label %loop_next1_right
59 br i1 %c2, label %loop_next2, label %loop_next2_right
63 br i1 %c3, label %loop_next3, label %loop_next3_right
67 br i1 %c4, label %loop_next4, label %loop_next4_right
71 br i1 %c5, label %loop_latch, label %loop_latch_right
75 store volatile i32 0, i32* %addr
76 %test_loop = icmp slt i32 %iv, 50
77 br i1 %test_loop, label %loop, label %exit