This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch] fold-const.c: Don't handle ASSERT_EXPR.
Hi Roger,
> > PR tree-optimization/21047
> > * fold-const.c (fold): Don't handle ASSERT_EXPR.
>
> You're right that this code in fold is dead and should be removed,
> but wouldn't it be better to also move it to fold_binary, so that
> it will be triggered if VRP (or anyone) else calls fold with an
> ASSERT_EXPR. For many tree codes, the transformations in "fold"
> serve as a form of documentation of their semantics.
Err, ASSERT_EXPR lives only during VRP. Plus (quote from my original
message),
Second, AFAICT, VRP never calls fold on ASSERT_EXPR. It does call
on ASSERT_EXPR_COND, but that's just a tcc_comparison, which fold
handles fine via fold_binary.
So I don't think it's a good idea to just move the dead code.
Kazu Hirata