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

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 9 05:42:18 PDT 2022


spatel added a comment.

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.


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