[InstCombine] fold mul of zext bools to 'and'
authorSanjay Patel <spatel@rotateright.com>
Fri, 3 Jul 2020 17:08:59 +0000 (13:08 -0400)
committerSanjay Patel <spatel@rotateright.com>
Fri, 3 Jul 2020 17:14:18 +0000 (13:14 -0400)
commit40fcc42498d8877d2d2a8548f3ac5c052b2723c2
tree0feaeb4b480e2456506ec7b02843d227fe8ac051
parent5d60377864f00983e44ac6adda94bcf60f441973
[InstCombine] fold mul of zext bools to 'and'

The base case only works because we are relying on a
poison-unsafe select transform; if that is fixed, we
would regress on patterns like this.

The extra use tests show that the select transform can't
be applied consistently. So it may be a regression to have
an extra instruction on 1 test, but that result was not
created safely and does not happen reliably.
llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
llvm/test/Transforms/InstCombine/mul.ll