[PATCH] D125220: [InstCombine] (rot X, ?) == 0/-1 --> X == 0/-1

Chenbing.Zheng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 12 02:30:37 PDT 2022


Chenbing.Zheng added a comment.

In D125220#3500470 <https://reviews.llvm.org/D125220#3500470>, @spatel wrote:

> This approach will not scale well. There are many transforms where we can allow undefs, but we did not bother to do it because there was no immediate motivation. 
> Also, if we are duplicating code/logic, then we are increasing the risk of bugs that are very hard to test/notice.
>
> I would prefer that we back through the callers to the line where `C` was captured and allow matching vectors with undefs (`m_APIntAllowUndef`). Then add a parameters/logic to decide if a vector constant with undef is acceptable.
>
> If that is too hard, then add an alternate code path from the caller for transforms where undef is allowed. Then **move** the transform under that caller rather than copying code.

Yer, I agree with you, but there are too many functions involved. I will try to do it.  As a first step I will simplify function ‘foldICmpInstWithConstant’  D125457 <https://reviews.llvm.org/D125457>.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D125220/new/

https://reviews.llvm.org/D125220



More information about the llvm-commits mailing list