[Bug tree-optimization/68021] [6 Regression] ice in rewrite_use_nonlinear_expr with -O3

amker at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Feb 8 15:41:00 GMT 2016


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68021

--- Comment #13 from amker at gcc dot gnu.org ---
Hmm, I posted a patch at
https://gcc.gnu.org/ml/gcc-patches/2016-02/msg00447.html
But after digging deeper I think the posted is unnecessary and it should be
fixed in fold stuff.

The ivopt logic is
1) create iv use for original biv candidate chosen by the algorithm.
2) rewrite iv use created in 1) using the original biv in
rewrite_use_nonlinear_expr.  (Here we use nonlinear use as the example)
3) If the iv use is exact the candidate increment stmt, then skip rewriting
since the computation is already there.
4) If that's not the case (in 3), it falls through  and uses get_computation to
rewrite the use.  As commented in #10, this may introduce redundant code, we
rely on following passes to remove them.

So for this case, the iv use created is direct for an original biv var.  The
values of the iv use and the original biv are same to each other.  Just the iv
use will be rewrite in a different form of computation to the original biv.

In other words, it is guaranteed that the iv use has same value as original
candidate when control flow comes to the ICE point.  The ICE really is caused
by inconsistent fold behavior.

So IMHO, we may have to fix the fold part...


More information about the Gcc-bugs mailing list