[PATCH] Optimize strlen comparisons against zero (take 3)
Richard Henderson
rth@redhat.com
Tue Nov 13 15:03:00 GMT 2001
On Wed, Nov 14, 2001 at 03:16:03PM -0700, Roger Sayle wrote:
> * fold-const.c (fold): Optimize strlen comparisons against zero.
> * string-opt-13.c: New testcase.
Applied. Couple o things:
One, watch your indentation -- it was off by 2.
Two, I added a check for (code == NE_EXPR || code == EQ_EXPR) for
pedantry. Other codes *shouldn't* have gotten there due to the
unsigned return value of strlen, but presupposing that an optimization
must have been done before and would not have been done after is a
bad idea.
r~
More information about the Gcc-patches
mailing list