diff --git a/llvm/test/Transforms/SimpleLoopUnswitch/exponential-nontrivial-unswitch-nested.ll b/llvm/test/Transforms/SimpleLoopUnswitch/exponential-nontrivial-unswitch-nested.ll --- a/llvm/test/Transforms/SimpleLoopUnswitch/exponential-nontrivial-unswitch-nested.ll +++ b/llvm/test/Transforms/SimpleLoopUnswitch/exponential-nontrivial-unswitch-nested.ll @@ -4,7 +4,7 @@ ; RUN: opt < %s -enable-unswitch-cost-multiplier=true \ ; RUN: -unswitch-num-initial-unscaled-candidates=0 -unswitch-siblings-toplevel-div=1 \ -; RUN: -passes='loop(simple-loop-unswitch),print' -disable-output 2>&1 | FileCheck %s --check-prefixes=LOOP1 +; RUN: -passes='loop-mssa(simple-loop-unswitch),print' -disable-output 2>&1 | FileCheck %s --check-prefixes=LOOP1 ; ; RUN: opt < %s -enable-unswitch-cost-multiplier=true \ ; RUN: -unswitch-num-initial-unscaled-candidates=0 -unswitch-siblings-toplevel-div=16 \ @@ -22,14 +22,13 @@ ; (unscaled candidates == 4) we start getting some unswitches, ; which leads to siblings multiplier kicking in. ; -; RUN: opt < %s -enable-unswitch-cost-multiplier=true \ -; RUN: -unswitch-num-initial-unscaled-candidates=4 -unswitch-siblings-toplevel-div=1 \ -; RUN: -passes='loop(simple-loop-unswitch),print' -disable-output 2>&1 | \ -; RUN: sort -b -k 1 | FileCheck %s --check-prefixes=LOOP-UNSCALE4-DIV1 +; The tests below also run licm, because it is needed to hoist out +; loop-invariant freeze instructions, which otherwise may block further +; unswitching. ; ; RUN: opt < %s -enable-unswitch-cost-multiplier=true \ ; RUN: -unswitch-num-initial-unscaled-candidates=4 -unswitch-siblings-toplevel-div=1 \ -; RUN: -passes='loop-mssa(simple-loop-unswitch),print' -disable-output 2>&1 | \ +; RUN: -passes='loop-mssa(licm,simple-loop-unswitch),print' -disable-output 2>&1 | \ ; RUN: sort -b -k 1 | FileCheck %s --check-prefixes=LOOP-UNSCALE4-DIV1 ; ; NB: sort -b is essential here and below, otherwise blanks might lead to different @@ -37,12 +36,7 @@ ; ; RUN: opt < %s -enable-unswitch-cost-multiplier=true \ ; RUN: -unswitch-num-initial-unscaled-candidates=4 -unswitch-siblings-toplevel-div=2 \ -; RUN: -passes='loop(simple-loop-unswitch),print' -disable-output 2>&1 | \ -; RUN: sort -b -k 1 | FileCheck %s --check-prefixes=LOOP-UNSCALE4-DIV2 -; -; RUN: opt < %s -enable-unswitch-cost-multiplier=true \ -; RUN: -unswitch-num-initial-unscaled-candidates=4 -unswitch-siblings-toplevel-div=2 \ -; RUN: -passes='loop-mssa(simple-loop-unswitch),print' -disable-output 2>&1 | \ +; RUN: -passes='loop-mssa(licm,simple-loop-unswitch),print' -disable-output 2>&1 | \ ; RUN: sort -b -k 1 | FileCheck %s --check-prefixes=LOOP-UNSCALE4-DIV2 ; ; Get @@ -50,11 +44,7 @@ ; loop nests when cost multiplier is disabled: ; ; RUN: opt < %s -enable-unswitch-cost-multiplier=false \ -; RUN: -passes='loop(simple-loop-unswitch),print' -disable-output 2>&1 | \ -; RUN: sort -b -k 1 | FileCheck %s --check-prefixes=LOOP32 -; -; RUN: opt < %s -enable-unswitch-cost-multiplier=false \ -; RUN: -passes='loop-mssa(simple-loop-unswitch),print' -disable-output 2>&1 | \ +; RUN: -passes='loop-mssa(licm,simple-loop-unswitch),print' -disable-output 2>&1 | \ ; RUN: sort -b -k 1 | FileCheck %s --check-prefixes=LOOP32 ; ; Single loop nest, not unswitched diff --git a/llvm/test/Transforms/SimpleLoopUnswitch/exponential-nontrivial-unswitch-nested2.ll b/llvm/test/Transforms/SimpleLoopUnswitch/exponential-nontrivial-unswitch-nested2.ll --- a/llvm/test/Transforms/SimpleLoopUnswitch/exponential-nontrivial-unswitch-nested2.ll +++ b/llvm/test/Transforms/SimpleLoopUnswitch/exponential-nontrivial-unswitch-nested2.ll @@ -24,18 +24,16 @@ ; RUN: -passes='loop-mssa(simple-loop-unswitch),print' -disable-output 2>&1 | FileCheck %s --check-prefixes=LOOP1 ; ; When we relax the candidates part of a multiplier formula -; When we relax the candidates part of a multiplier formula ; (unscaled candidates == 2) we start getting some unswitches in outer loops, ; which leads to siblings multiplier kicking in. ; -; RUN: opt < %s -enable-unswitch-cost-multiplier=true \ -; RUN: -unswitch-num-initial-unscaled-candidates=3 -unswitch-siblings-toplevel-div=1 \ -; RUN: -passes='loop(simple-loop-unswitch),print' -disable-output 2>&1 | \ -; RUN: sort -b -k 1 | FileCheck %s --check-prefixes=LOOP-UNSCALE3-DIV1 +; The tests below also run licm, because it is needed to hoist out +; loop-invariant freeze instructions, which otherwise may block further +; unswitching. ; ; RUN: opt < %s -enable-unswitch-cost-multiplier=true \ ; RUN: -unswitch-num-initial-unscaled-candidates=3 -unswitch-siblings-toplevel-div=1 \ -; RUN: -passes='loop-mssa(simple-loop-unswitch),print' -disable-output 2>&1 | \ +; RUN: -passes='loop-mssa(licm,simple-loop-unswitch),print' -disable-output 2>&1 | \ ; RUN: sort -b -k 1 | FileCheck %s --check-prefixes=LOOP-UNSCALE3-DIV1 ; ; NB: sort -b is essential here and below, otherwise blanks might lead to different @@ -43,22 +41,13 @@ ; ; RUN: opt < %s -enable-unswitch-cost-multiplier=true \ ; RUN: -unswitch-num-initial-unscaled-candidates=3 -unswitch-siblings-toplevel-div=2 \ -; RUN: -passes='loop(simple-loop-unswitch),print' -disable-output 2>&1 | \ -; RUN: sort -b -k 1 | FileCheck %s --check-prefixes=LOOP-UNSCALE3-DIV2 -; -; RUN: opt < %s -enable-unswitch-cost-multiplier=true \ -; RUN: -unswitch-num-initial-unscaled-candidates=3 -unswitch-siblings-toplevel-div=2 \ -; RUN: -passes='loop-mssa(simple-loop-unswitch),print' -disable-output 2>&1 | \ +; RUN: -passes='loop-mssa(licm,simple-loop-unswitch),print' -disable-output 2>&1 | \ ; RUN: sort -b -k 1 | FileCheck %s --check-prefixes=LOOP-UNSCALE3-DIV2 ; ; With disabled cost-multiplier we get maximal possible amount of unswitches. ; ; RUN: opt < %s -enable-unswitch-cost-multiplier=false \ -; RUN: -passes='loop(simple-loop-unswitch),print' -disable-output 2>&1 | \ -; RUN: sort -b -k 1 | FileCheck %s --check-prefixes=LOOP-MAX -; -; RUN: opt < %s -enable-unswitch-cost-multiplier=false \ -; RUN: -passes='loop-mssa(simple-loop-unswitch),print' -disable-output 2>&1 | \ +; RUN: -passes='loop-mssa(licm,simple-loop-unswitch),print' -disable-output 2>&1 | \ ; RUN: sort -b -k 1 | FileCheck %s --check-prefixes=LOOP-MAX ; ; Single loop nest, not unswitched diff --git a/llvm/test/Transforms/SimpleLoopUnswitch/exponential-switch-unswitch.ll b/llvm/test/Transforms/SimpleLoopUnswitch/exponential-switch-unswitch.ll --- a/llvm/test/Transforms/SimpleLoopUnswitch/exponential-switch-unswitch.ll +++ b/llvm/test/Transforms/SimpleLoopUnswitch/exponential-switch-unswitch.ll @@ -28,14 +28,13 @@ ; With relaxed candidates multiplier (unscaled candidates == 8) we should allow ; some unswitches to happen until siblings multiplier starts kicking in: ; -; RUN: opt < %s -enable-unswitch-cost-multiplier=true \ -; RUN: -unswitch-num-initial-unscaled-candidates=8 -unswitch-siblings-toplevel-div=1 \ -; RUN: -passes='loop(simple-loop-unswitch),print' -disable-output 2>&1 | \ -; RUN: sort -b -k 1 | FileCheck %s --check-prefixes=LOOP-RELAX +; The tests below also run licm, because it is needed to hoist out +; loop-invariant freeze instructions, which otherwise may block further +; unswitching. ; ; RUN: opt < %s -enable-unswitch-cost-multiplier=true \ ; RUN: -unswitch-num-initial-unscaled-candidates=8 -unswitch-siblings-toplevel-div=1 \ -; RUN: -passes='loop-mssa(simple-loop-unswitch),print' -disable-output 2>&1 | \ +; RUN: -passes='loop-mssa(licm,simple-loop-unswitch),print' -disable-output 2>&1 | \ ; RUN: sort -b -k 1 | FileCheck %s --check-prefixes=LOOP-RELAX ; ; With relaxed candidates multiplier (unscaled candidates == 8) and with relaxed @@ -44,22 +43,13 @@ ; ; RUN: opt < %s -enable-unswitch-cost-multiplier=true \ ; RUN: -unswitch-num-initial-unscaled-candidates=8 -unswitch-siblings-toplevel-div=8 \ -; RUN: -passes='loop(simple-loop-unswitch),print' -disable-output 2>&1 | \ -; RUN: sort -b -k 1 | FileCheck %s --check-prefixes=LOOP-RELAX2 -; -; RUN: opt < %s -enable-unswitch-cost-multiplier=true \ -; RUN: -unswitch-num-initial-unscaled-candidates=8 -unswitch-siblings-toplevel-div=8 \ -; RUN: -passes='loop-mssa(simple-loop-unswitch),print' -disable-output 2>&1 | \ +; RUN: -passes='loop-mssa(licm,simple-loop-unswitch),print' -disable-output 2>&1 | \ ; RUN: sort -b -k 1 | FileCheck %s --check-prefixes=LOOP-RELAX2 ; ; We get hundreds of copies of the loop when cost multiplier is disabled: ; ; RUN: opt < %s -enable-unswitch-cost-multiplier=false \ -; RUN: -passes='loop(simple-loop-unswitch),print' -disable-output 2>&1 | \ -; RUN: sort -b -k 1 | FileCheck %s --check-prefixes=LOOP-MAX -; -; RUN: opt < %s -enable-unswitch-cost-multiplier=false \ -; RUN: -passes='loop-mssa(simple-loop-unswitch),print' -disable-output 2>&1 | \ +; RUN: -passes='loop-mssa(licm,simple-loop-unswitch),print' -disable-output 2>&1 | \ ; RUN: sort -b -k 1 | FileCheck %s --check-prefixes=LOOP-MAX ; Single loop nest, not unswitched