This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH]: Fix missed PRE optimization discovered


On Sat, Oct 18, 2008 at 6:27 AM, Richard Guenther
<richard.guenther@gmail.com> wrote:
> On Sat, Oct 18, 2008 at 4:02 AM, Daniel Berlin <dberlin@dberlin.org> wrote:
>> I'm currently testing the following, which at least doesn't crash on
>> the minimized testcase i produced :)
>
> Looking at that patch I wonder if
>
> -          if (TREE_TYPE (constant) != type)
> +         if (!useless_type_conversion_p (type, TREE_TYPE (constant)))
>
> will also work.

Probably, but we really shouldn't just willy nilly replace one with
the other anyway. :)

If you like, i can try both :)
At worst what is going to happen is that we will call fold_convert a
few more times than necessary, and in very strange cases (where
converting one constant to the other requires a real conversion),
create a small amount of necessary code.

>
> Richard.
>
>>
>> Index: tree-ssa-pre.c
>> ===================================================================
>> --- tree-ssa-pre.c      (revision 141195)
>> +++ tree-ssa-pre.c      (working copy)
>> @@ -3022,21 +3022,13 @@
>>          if (TREE_TYPE (constant) != type)
>>            {
>>              tree builtexpr = fold_convert (type, constant);
>> -             if (is_gimple_min_invariant (builtexpr))
>> +             if (!is_gimple_min_invariant (builtexpr))
>>                {
>> -                 PRE_EXPR_CONSTANT (eprime) = builtexpr;
>> -               }
>> -             else
>> -               {
>>                  tree forcedexpr = force_gimple_operand (builtexpr,
>>                                                          &stmts, true,
>>                                                          NULL);
>> -                 if (is_gimple_min_invariant (forcedexpr))
>> +                 if (!is_gimple_min_invariant (forcedexpr))
>>                    {
>> -                     PRE_EXPR_CONSTANT (eprime) = forcedexpr;
>> -                   }
>> -                 else
>> -                   {
>>                      if (forcedexpr != builtexpr)
>>                        {
>>                          VN_INFO_GET (forcedexpr)->valnum = PRE_EXPR_CONSTANT (eprime);
>>
>>
>> On Fri, Oct 17, 2008 at 2:34 PM, Laurent GUERBY <laurent@guerby.net> wrote:
>>> On Fri, 2008-10-17 at 19:17 +0200, Eric Botcazou wrote:
>>>> > Doesn't break on x86_64-linux-gnu for me (ubuntu hardy), trying
>>>> > i686-pc-linux-gnu.
>>>>
>>>> Really sure?  Our x86 and x86-64 testers are down and Laurent Guerby's tester
>>>> on x86-64 hasn't posted anything to gcc-results@ since rev 141181.
>>>
>>> I confirm 141181 was the last to bootstrap c,ada on x86_64,
>>> the next update of the build script led to a failure:
>>>
>>> Fri Oct 17 04:18:33 CEST 2008
>>> Updating SVN tree
>>> U    gcc/DATESTAMP
>>> U    gcc/ChangeLog
>>> U    gcc/tree-ssa-pre.c
>>> Updated to revision 141186.
>>> ...
>>>
>>> raised STORAGE_ERROR : stack overflow (or erroneous memory access)
>>> gnatmake: "/home/guerby/trunk/gcc/ada/gnatname.adb" compilation error
>>> make[3]: *** [common-tools] Error 4
>>> make[3]: Leaving directory `/home/guerby/build/gcc/ada/tools'
>>> make[2]: *** [gnattools-native] Error 2
>>> make[2]: Leaving directory `/home/guerby/build/gnattools'
>>> make[1]: *** [all-gnattools] Error 2
>>> make[1]: Leaving directory `/home/guerby/build'
>>> make: *** [bootstrap] Error 2
>>> Fri Oct 17 06:22:24 CEST 2008
>>>
>>> For reference, the configure line of my build script is:
>>>
>>> ../trunk/configure --prefix=/n/11/guerby/install-trunk
>>> --enable-languages=c,ada --enable-__cxa_atexit --disable-nls
>>> --enable-threads=posix --with-mpfr=/opt/cfarm/mpfr-2.3.1
>>>
>>> And base version of GCC is "4.1.2 20061115 (prerelease) (Debian
>>> 4.1.1-21)".
>>>
>>> Laurent
>>>
>>>
>>>
>>
>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]