[PATCH] D32725: [InstCombine] Apply deMorgan to (and/or (not cmp1), cmp2) when cmp1 has multiple uses, but cmp2 has a single use

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 2 07:01:51 PDT 2017


spatel added a reviewer: efriedma.
spatel added a comment.

The transform seems reasonable, but I wonder if we can pull more of the code for DeMorgan folds together. Maybe this can be added to matchDeMorgansLaws? Also, I'm trying to clean up the block in https://reviews.llvm.org/D32665. Below that, we use "IsFreeToInvert" and that does have a param to account for multi-use cases. Could/should we use IsFreeToInvert instead of writing a special match for this case?

As you said, it would be great to have the tests for various cases under test/Transforms/InstCombine, so we'll know what happens in those cases. I suspect we have a lot of transforms where we're either stopping short because of !hasOneUse() or overstepping because that condition is missing.


https://reviews.llvm.org/D32725





More information about the llvm-commits mailing list