[PATCH] D29631: SystemZTargetTransformInfo cost functions and some common code changes

Matthew Simpson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 24 09:30:35 PST 2017


mssimpso added inline comments.


================
Comment at: lib/Transforms/Vectorize/LoopVectorize.cpp:7236-7244
+    // If this is the loop-latch compare for the back branch, just add the
+    // scalar value. Should this check be done in caller instead?
+    bool LikelyVectorized = true;
+    if (I->hasOneUse()) {
+      if (BranchInst *BI = dyn_cast<BranchInst>(I->use_begin()->getUser())) {
+        if (BI->getParent() == TheLoop->getLoopLatch())
+          LikelyVectorized = false;
----------------
mssimpso wrote:
> Hi,
> 
> I've only looked at the vectorizer change here, but this code is not needed. Before computing costs, we collect the uniform values in collectLoopUniforms(). ICmp instructions of the kind here are marked uniform. Then in getInstructionCost(), we check if an instruction is uniform (isUniformAfterVectorization()), and if so, always return "1" for the cost, regardless of VF.
> 
> Also, floating-point induction variables aren't allowed to be "primary" induction variables. So it shouldn't be the case that you would have a FCmp feeding the back edge branch.
Correction: we always return the cost of the *scalar* compare if it is uniform, regardless of VF.


https://reviews.llvm.org/D29631





More information about the llvm-commits mailing list