[PATCH] D41948: [SLP] Fix vectorization for tree with trunc to minimum required bit width.

Matthew Simpson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 12 14:14:59 PST 2018


mssimpso added a comment.

Thanks for cleaning this up.



================
Comment at: lib/Transforms/Vectorize/SLPVectorizer.cpp:2061-2064
+      int VecCost = 0;
+      // Check if the values are candidates to demote.
+      if (!MinBWs.count(VL0) || VecTy != SrcVecTy)
+        VecCost = TTI->getCastInstrCost(VL0->getOpcode(), VecTy, SrcVecTy, VL0);
----------------
Makes sense.


================
Comment at: lib/Transforms/Vectorize/SLPVectorizer.cpp:4023-4025
+    // Do not include top zext/sext/trunc operations to those to be demoted, it
+    // produces noise cast<vect>, trunc <vect>, exctract <vect>, cast <extract>
+    // sequence.
----------------
What do you mean by "top" here?  Do you just mean that the initial Root should not be a cast? If so, would it be easier to check that here, rather than passing the flag in collectValuesToDemote?


https://reviews.llvm.org/D41948





More information about the llvm-commits mailing list