[PATCH] D52747: [InstCombine] reverse 'trunc X to <N x i1>' canonicalization

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 2 17:45:44 PDT 2018


spatel updated this revision to Diff 168059.
spatel added a comment.

Patch updated:

1. Moved the and+icmp --> trunc transform earlier in visitICmpInst, so we have a better idea about potential regressions.
2. This required adding 2 trunc folds to avoid known regressions. These transforms have phantom (cosmetic-only) test diffs in apint-shift.ll and icmp.ll::icmp_and_or_lshr_cst_vec(), so we can see that the new code is firing on the patterns with trunc.
3. The other test diffs are all wins in IR (less instructions). Included in that, we see that 1 of the existing icmp transforms that we're replacing doesn't work if the operands are commuted.
4. The loop vectorizer tests (running with full -O3 in that test file...) produce mixed results in codegen: both tests improve (less instructions in the inner loop) on KNL, but regress (more instructions in the inner loop) with AVX2. Note: that diff should've been in the previous rev of this patch, but I missed it.

So we have IR improvements in all cases shown here (but there could be regressions for patterns that have no vector test coverage), codegen improvements for the motivating blendv cases across a range of targets, codegen improvements on larger loop tests on AVX512, but codegen regressions with that same IR on AVX2.


https://reviews.llvm.org/D52747

Files:
  lib/Transforms/InstCombine/InstCombineCasts.cpp
  lib/Transforms/InstCombine/InstCombineCompares.cpp
  test/Transforms/InstCombine/apint-shift.ll
  test/Transforms/InstCombine/apint-shl-trunc.ll
  test/Transforms/InstCombine/icmp.ll
  test/Transforms/InstCombine/vector-casts.ll
  test/Transforms/LoopVectorize/X86/masked_load_store.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D52747.168059.patch
Type: text/x-patch
Size: 51681 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181003/00212d85/attachment.bin>


More information about the llvm-commits mailing list