https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92233
--- Comment #1 from Marc Glisse <glisse at gcc dot gnu.org> --- (llvm doesn't do it either) Would some kind of threading be the most natural way to handle this? If the compiler duplicates the code as if (a==0) return a*b; else if (b==0) return a*b; then it becomes easy to optimize. There could be a heuristic to encourage the compiler to do that when the test is var == cst and var is used in an operation that greatly simplifies for cst. On powerpc64le-linux-gnu (so the 2 tests aren't combined as bit_ior), if I test test_mul(a,b)==0 in another function, it does simplify to true, with DOM2 doing the interesting part.