[PATCH] D27933: [InstCombine] fix operand-complexity-based canonicalization (PR28296)

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 19 11:25:26 PST 2016


spatel created this revision.
spatel added reviewers: majnemer, efriedma, sanjoy, hfinkel.
spatel added a subscriber: llvm-commits.
Herald added a subscriber: mcrosier.

The code comments didn't match the code logic, and we didn't actually distinguish the fake unary (not/neg/fneg) operators from arguments. Adding another level to the weighting scheme provides more structure and can help simplify the pattern matching in InstCombine and other places.

I fixed regressions that would have shown up from this change in:
https://reviews.llvm.org/rL290067
https://reviews.llvm.org/rL290127

But that doesn't mean there are no pattern-matching logic holes left; some combines may just be missing regression tests.

The cmp predicate changes in the LoopVectorize/minmax_reduction.ll test show a potential missed canonicalization for min/max ops.

Should fix:
https://llvm.org/bugs/show_bug.cgi?id=28296


https://reviews.llvm.org/D27933

Files:
  lib/Transforms/InstCombine/InstCombineInternal.h
  test/Transforms/BBVectorize/X86/loop1.ll
  test/Transforms/BBVectorize/loop1.ll
  test/Transforms/InstCombine/add.ll
  test/Transforms/InstCombine/and.ll
  test/Transforms/InstCombine/apint-sub.ll
  test/Transforms/InstCombine/icmp.ll
  test/Transforms/InstCombine/or.ll
  test/Transforms/InstCombine/select.ll
  test/Transforms/InstCombine/sub.ll
  test/Transforms/InstCombine/vec_demanded_elts.ll
  test/Transforms/InstCombine/vec_sext.ll
  test/Transforms/InstCombine/x86-avx512.ll
  test/Transforms/InstCombine/xor.ll
  test/Transforms/InstCombine/xor2.ll
  test/Transforms/LoopVectorize/minmax_reduction.ll
  test/Transforms/LoopVersioningLICM/loopversioningLICM1.ll
  test/Transforms/SLPVectorizer/X86/operandorder.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D27933.81975.patch
Type: text/x-patch
Size: 19491 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161219/95293844/attachment-0001.bin>


More information about the llvm-commits mailing list