[PATCH] D66607: [InstCombine] matchThreeWayIntCompare(): commutativity awareness

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 22 11:06:23 PDT 2019


lebedev.ri created this revision.
lebedev.ri added reviewers: spatel, nikic, efriedma, xbolva00.
lebedev.ri added a project: LLVM.
Herald added a subscriber: hiraditya.
lebedev.ri added a parent revision: D66232: [InstCombine] Try to reuse constant from select in leading comparison.

`matchThreeWayIntCompare()` looks for

  select i1 (a == b),
         i32 Equal,
         i32 (select i1 (a < b), i32 Less, i32 Greater)

but both of these selects/compares can be in it's commuted form,
so out of 4 variants, only the most basic one is handled.
This fixes regression being introduced in D66232 <https://reviews.llvm.org/D66232>.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D66607

Files:
  llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
  llvm/test/Transforms/InstCombine/unrecognized_three-way-comparison.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D66607.216672.patch
Type: text/x-patch
Size: 6398 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190822/b90fefd9/attachment-0001.bin>


More information about the llvm-commits mailing list