[PATCH] D124988: [DAGCombiner] Fold (sext/zext undef) -> 0 and aext(undef) -> undef.

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 5 11:08:14 PDT 2022


craig.topper added a comment.

In D124988#3494483 <https://reviews.llvm.org/D124988#3494483>, @jrtc27 wrote:

> What's the justification for 0 rather than undef? That the high bits need to be guaranteed equal even for undef input?

For zext the high bits need to be 0 and for sext the high bits need to match. The result of the fold needs to produce a value that is possible given the undefined input we received. If we folded to undef that would be a larger set of values than were possible. We're allowed to assume a specific value for the input. So here we've assume the input is 0.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D124988



More information about the llvm-commits mailing list