From 5c14ed89f606155089150783fc5e6ddce36c836b Mon Sep 17 00:00:00 2001 From: Philip Reames Date: Thu, 29 Mar 2018 20:32:15 +0000 Subject: [PATCH] [NFC][LICM] Rearrange checks to have the cheap bail out first llvm-svn: 328822 --- llvm/lib/Transforms/Scalar/LoopUnswitch.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/llvm/lib/Transforms/Scalar/LoopUnswitch.cpp b/llvm/lib/Transforms/Scalar/LoopUnswitch.cpp index ec1f4a7..91a3008 100644 --- a/llvm/lib/Transforms/Scalar/LoopUnswitch.cpp +++ b/llvm/lib/Transforms/Scalar/LoopUnswitch.cpp @@ -635,6 +635,12 @@ bool LoopUnswitch::processCurrentLoop() { return true; } + // Do not do non-trivial unswitch while optimizing for size. + // FIXME: Use Function::optForSize(). + if (OptimizeForSize || + loopHeader->getParent()->hasFnAttribute(Attribute::OptimizeForSize)) + return false; + // Run through the instructions in the loop, keeping track of three things: // // - That we do not unswitch loops containing convergent operations, as we @@ -666,12 +672,6 @@ bool LoopUnswitch::processCurrentLoop() { } } - // Do not do non-trivial unswitch while optimizing for size. - // FIXME: Use Function::optForSize(). - if (OptimizeForSize || - loopHeader->getParent()->hasFnAttribute(Attribute::OptimizeForSize)) - return false; - for (IntrinsicInst *Guard : Guards) { Value *LoopCond = FindLIVLoopCondition(Guard->getOperand(0), currentLoop, Changed).first; -- 2.7.4