diff --git a/lib/Transforms/Vectorize/LoopVectorize.cpp b/lib/Transforms/Vectorize/LoopVectorize.cpp index 58a1a746555..88e76dabfb5 100644 --- a/lib/Transforms/Vectorize/LoopVectorize.cpp +++ b/lib/Transforms/Vectorize/LoopVectorize.cpp @@ -2432,6 +2432,10 @@ bool LoopVectorizationLegality::canVectorizeWithIfConvert() { return false; } + // Check that we can actually speculate the hoistable loads. + if (!LoadSpeculation.canHoistAllLoads()) + return false; + // We can if-convert this loop. return true; } @@ -3369,10 +3373,6 @@ bool LoopVectorizationLegality::blockCanBePredicated(BasicBlock *BB) { } } - // Check that we can actually speculate the hoistable loads. - if (!LoadSpeculation.canHoistAllLoads()) - return false; - return true; }