[llvm] [SelectionDAG] Make sure demanded lanes for AND/MUL-by-zero are frozen (PR #180727)

Björn Pettersson via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 12 01:58:14 PST 2026


bjope wrote:

> LGTM - with any additional test coverage for the other issues fixed by this.

The changes in SelectionDAG is covered by the new test in test/CodeGen/X86/insertelement-zero.ll .

I looked a bit at both #180409 and #176682 to see if I could make smaller reproducers (for example for armv8 and MUL). I could get something that showed codegen diffs depending on this patch. But it was not obvious to me if those asm diffs really highlighted the fault. It is quite difficult when poison often ends up being folded to zero. So there is not really anything that is undefined in the final asm so verifying that an MUL by zero was "poison" at some stage during ISel is not easy to spot. The alternative is to just reduce the runnable program (showing that we used to get an undefined result, but not any longer). Such reductions tends to result in a quite large regression test that I do not find very interesting as lit regression tests.

An alternative could be to check the output from `-debug-only=isel`. But I guess those debug printouts aren't that stable to use here.

Since this seem to solve several complicated issues, and the added test case cover the code changes, I will move forward landing this.

If someone has better ideas for how to reduce this kind of failures, or how to test/verify fixes like this, then I'd like to learn about it.

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


More information about the llvm-commits mailing list