OSDN Git Service

LoopVectorize: Move call of canHoistAllLoads to canVectorizeWithIfConvert
authorArnold Schwaighofer <aschwaighofer@apple.com>
Wed, 15 May 2013 22:38:14 +0000 (22:38 +0000)
committerArnold Schwaighofer <aschwaighofer@apple.com>
Wed, 15 May 2013 22:38:14 +0000 (22:38 +0000)
We only want to check this once, not for every conditional block in the loop.

No functionality change (except that we don't perform a check redudantly
anymore).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@181942 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Vectorize/LoopVectorize.cpp

index 58a1a74..88e76da 100644 (file)
@@ -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;
 }