[PATCH] D135415: [GlobalISel] Make comparison matcher commutative for commutative predicates

Jessica Paquette via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 6 17:00:51 PDT 2022


paquette created this revision.
paquette added reviewers: aemerson, arsenm.
Herald added subscribers: hiraditya, rovka.
Herald added a project: All.
paquette requested review of this revision.
Herald added a subscriber: wdng.
Herald added a project: LLVM.

This allows us to automate pattern-matching for things like:

- (x == y) == (y == x)
- (x != y) == (y != x)

This came up as a potential simplification for D135380 <https://reviews.llvm.org/D135380>.

In order to do this, we need to be able to check if a predicate is commutative without having access to a CmpInst. Add static functions similar to `isEquality` to achieve this.


https://reviews.llvm.org/D135415

Files:
  llvm/include/llvm/CodeGen/GlobalISel/MIPatternMatch.h
  llvm/include/llvm/IR/InstrTypes.h
  llvm/include/llvm/IR/Instructions.h
  llvm/lib/IR/Instructions.cpp
  llvm/unittests/CodeGen/GlobalISel/PatternMatchTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D135415.465934.patch
Type: text/x-patch
Size: 7427 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221007/2a8558f3/attachment.bin>


More information about the llvm-commits mailing list