[RFC][4.4] PR rtl-optimization/3507 appalling optimization with sub/cmp
Paolo Bonzini
bonzini@gnu.org
Thu Nov 29 14:35:00 GMT 2007
> (cse_main): Ask DF for def-use chains.
I'm not sure I like using def-use chains in CSE. The pass works in
completely different ways. For example we already have
find_comparison_args doing the reverse of def-use chains.
/* Given an operation (CODE, *PARG1, *PARG2), where code is a comparison
operation (EQ, NE, GT, etc.), follow it back through the hash table and
what values are being compared.
*PARG1 and *PARG2 are updated to contain the rtx representing the values
actually being compared. For example, if *PARG1 was (cc0) and *PARG2
was (const_int 0), *PARG1 and *PARG2 will be set to the objects that
were
compared to produce cc0.
The return value is the comparison operator and is either the code of
A or the code corresponding to the inverse of the comparison. */
Second, and more important, the optimization belongs in fold_rtx, just
before
rtx op0 = const_arg0 ? const_arg0 : folded_arg0;
rtx op1 = const_arg1 ? const_arg1 : folded_arg1;
new = simplify_relational_operation (code, mode, mode_arg0, op0, op1);
and could use find_comparison_args+lookup to extract the information it
needs.
Paolo
More information about the Gcc-patches
mailing list