[PATCH] D24419: [InstCombine] use commutative matchers for patterns with commutative operators

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 9 12:13:34 PDT 2016


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

This is a bandage on a wound that needs stitches.

Background/motivation: I was circling back around to https://llvm.org/bugs/show_bug.cgi?id=28296 . I made a simple patch for that and noticed some regressions. I added test cases for those with rL281055, and this is hopefully the minimal fix for just those cases.

But as you can see from the surrounding untouched folds, we are missing commuted patterns all over the place, and of course there are no regression tests to cover any of those cases.

It seems like we could sprinkle "m_c_" dust all over this file and catch most of the missing folds, but then we still wouldn't have test coverage, and we'd still miss some fraction of commuted patterns because they require adjustments to the match order. 

Another thought: are there any cases where we do *not* want to match the commuted variants of a pattern? If there are none of those, then could we just change the definitions for all commutative pattern matchers, so "m_c_" becomes automatic?


https://reviews.llvm.org/D24419

Files:
  lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
  test/Transforms/InstCombine/or-xor.ll
  test/Transforms/InstCombine/or.ll
  test/Transforms/InstCombine/xor2.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D24419.70876.patch
Type: text/x-patch
Size: 9094 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160909/885a8565/attachment.bin>


More information about the llvm-commits mailing list