------- Comment #22 from rguenther at suse dot de 2008-10-15 18:33 ------- Subject: Re: [4.4 Regression] calculix gets wrong answer for -O1 -ffast-math
On Wed, 15 Oct 2008, dberlin at dberlin dot org wrote: > ------- Comment #21 from dberlin at gcc dot gnu dot org 2008-10-15 17:55 > ------- > Subject: Re: [4.4 Regression] calculix gets wrong answer for -O1 -ffast-math > > > > > It already does (I fixed that recently), but we only phi-translate during > > insertion and we > > don't insert for that case, as obviously there is no partial redundancy. > > True, but if it discovered all the new phi arguments would be constant > it used to create a new phi node with the new constant values and let > eliminate replace the old calculation with the new phi node. > > Maybe it only did this if all the constants ended up the same value, > but it would be trivial to do it if all the arguments are constant, > regardless of whether they are the same value. > :) Well, we already do for int foo (int b) { double i; if (b) i = 4; else i = 9; return __builtin_sqrt(i); } <bb 4>: # i_1 = PHI <4.0e+0(5), 9.0e+0(3)> # prephitmp.11_7 = PHI <2.0e+0(5), 3.0e+0(3)> # prephitmp.12_8 = PHI <2(5), 3(3)> D.1238_5 = prephitmp.11_7; D.1237_6 = prephitmp.12_8; return D.1237_6; at least. Somebody needs to look why it doesn't happen for the testcase posted. Richard. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37449