Richard Guenther - Re: [patch] for PR 23361 (original) (raw)
This is the mail archive of the gcc-patches@gcc.gnu.orgmailing list for the GCC project.
Hello,
one of the reasons for this PR is that we fail to fold expressions like a + 10 > MIN_INT + 2, that are always true (assuming that the arithmetics in the considered type does not overflow). Such expressions are fairly often produced by number of iterations analysis. This patch implements such simplifications.
Bootstrapped & regtested on i686 and x86_64.
Hmm, this looks overly complicated. But maybe I'm missing something obvious - the attached also works for your testcase, but I dind't yet bootstrap & test it.
well, it seems to work (*). I think you should also extend the comment explaining how the code works -- it took me about half an hour before I understood it. Also please include the compare-3 testcase (it took me longer time to write than the fold-const code :-)