[llvm] [SelectionDAG] Fix bug related to demanded bits/elts for BITCAST (PR #139085)

Björn Pettersson via llvm-commits llvm-commits at lists.llvm.org
Thu May 8 07:06:18 PDT 2025


bjope wrote:

Doing a simple fix like this result in lots of lit test diffs. Unfortunately, I guess mostly regressions.

It could be possible to pass around a "MustNotMakeUndemandedEltsMorePoisonous" flag (or bitmask) in the recursive calls to SimplifyDemanded*, and set that to true for the BITCAST cases. It would allow us to do most simplifications even for BITCAST when we know that the bits from some source elements aren't used (although they must not be turned into poison). Such a hack would reduce the amount of lit test diffs and regressions. But we need to make a lot of boiler plate code changes, as well as finding all places where undemanded elements can be simplified as poison.

Another option might be to introduce new DAG combines etc to reduce amount of regressions that way. No idea how complicated that would be.

https://github.com/llvm/llvm-project/pull/139085


More information about the llvm-commits mailing list