https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112374
--- Comment #46 from Robin Dapp <rdapp at gcc dot gnu.org> --- (In reply to Jakub Jelinek from comment #43) > Now, the patch changed it to allow one extra use in certain cases (but I > think only on use_stmt, because there should be one use on use_stmt and if > there is some other in the loop, that would be already too much). So I > think my patch ought to work and the above would be more expensive (as it > would need to check each op_use_stmt for being suitable internal call). > the code before Your patch looks good. What I wanted to do, originally, is to just skip the reduction variable's next use in the else value and this is what your patch ensures. I agree, I don't think we actually need to check other uses in that manner (because even the use as a proper op would be too much) so what I posted last will do more work than necessary - it might just make the whole thing a bit clearer.