[PATCH] D31960: [InstSimplify] fold identity shuffles (recursing if needed)

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 19 09:22:49 PDT 2017


spatel added inline comments.


================
Comment at: lib/Analysis/InstructionSimplify.cpp:4188-4191
+  for (unsigned i = 0; i != MaskNumElts; ++i) {
+    // Note that recursion is limited for each vector element, so if any element
+    // exceeds the limit, this will fail to simplify.
+    RootVec = foldIdentityShuffles(i, Op0, Op1, Mask, RootVec, i, MaxRecurse);
----------------
andreadb wrote:
> You can skip this loop if you know in advance that at least one index in Mask is undef.
> Otherwise, you would end up with needless recursive calls to foldIdentityShuffles().
Sure - I'll add this check before committing.

Thanks, all!


https://reviews.llvm.org/D31960





More information about the llvm-commits mailing list