[PATCH] D51942: [InstCombine] Fold (C/x)>0 into x>0 if possible

Martin Elshuber via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 25 10:59:50 PDT 2018


marels added a comment.

Thank you for the input,

I updated the code to support vectors using the match API. But before uploading I have question.

I was not able to find a way to match the following predicates with the existing API.

1. All elements are non-zero
2. All elements are positive
3. All elements are negative

These are important to correctly handle some cases:

The following cannot be folded because the new predicate is ambiguous.

  C = <2 x float> <float 1.0, float -1.0>

The following cannot be folded because the one element violates the assumption that C=0.

  C = <2 x float> <float 1.0, float 0.0>

This is not a big thing because it can be easily added to to PatternMatch.h (same implementation as m_AnyZeroFP). I think it is better submit a separate change for this. Do you agree, or shall I bunch both changes together?

@spatel what do you think about @john.brawn suggestion to removing the hasAllowReciprocal check?


Repository:
  rL LLVM

https://reviews.llvm.org/D51942





More information about the llvm-commits mailing list