Re: Which pass optimizes if (x != x + 10) to if (1)?
|[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]|
On 03/21/2012 07:00 AM, Zhenqiang Chen wrote: > Thank you for the comment. I found the root cause. In function > tree_swap_operands_p (fold-const.c), there is a check > > if (optimize_function_for_size_p (cfun)) > return 0; > > which blocks to swap (x != x + 10) to (x + 10 != x). And the following > optimization can only handle (x + 10 != x). > > In most cases, constant-folding will benefit for code size. Any reason > to add this check? If you search the history you'll probably find a bug that was fixed by this (admittedly rather odd) test. Andrew.