Thanks for your comments.
I am not quite clear about the importance of such an optimization. As
usually MSTORE are lowered from MSTID/memcpy-alike-intrinsics. It looks
like not very important for C, as the lowering are usually 1-1 mapping and
not introducing redanduncies.
I need to look some further to figure out what is needed to enable it.
BTW, any comments about the patch itself?
Best Regards,
Yiran
On Mon, Nov 28, 2011 at 8:43 PM, Sun Chan <sun.c...@gmail.com> wrote:
> Sorry, stupid of me.
> I understand wopt does not do copy prop of mload to mstore. OTOH, this had
> been a goal for a long time. Anyway you can make that work?
> Sun
>
> On Tue, Nov 29, 2011 at 12:37 PM, Yiran Wang <yiran.w...@gmail.com> wrote:
>
>> Em, I think you are saying that once entered, it would not exit, but the
>> loop is not entered at the very beginning, as the initial test would fail.
>>
>> Regards,
>> Yiran
>>
>>
>> On Mon, Nov 28, 2011 at 6:15 PM, Sun Chan <sun.c...@gmail.com> wrote:
>>
>>> your example should infinite loop. Pls double check before we further
>>> discuss this
>>> Sun
>>>
>>> On Tue, Nov 29, 2011 at 8:41 AM, Yiran Wang <yiran.w...@gmail.com>wrote:
>>>
>>>> Hi All,
>>>>
>>>> Could a gatekeeper review this patch?
>>>>
>>>> The test case is as following, and the bug is triggered, when compiling
>>>> it with -O2.
>>>>
>>>> #include <string.h>
>>>>
>>>> struct x{
>>>> int y;
>>>> int z;
>>>> };
>>>>
>>>> int foo()
>>>> {
>>>> struct x xyz,abc;
>>>> int i;
>>>> memset(&xyz,0,sizeof(xyz));
>>>> i = 1;
>>>> while( i < 0 )
>>>> {
>>>> abc.y += xyz.z;
>>>> xyz.z += 1;
>>>> i+=i;
>>>> }
>>>> memcpy(&abc,&xyz,sizeof(xyz));
>>>> return abc.y ;
>>>> }
>>>>
>>>> The issue is that after WOPT remove the while loop, it renames SSA and
>>>> connect the MSTORE and MLOAD lowered from memset and memcpy respectively.
>>>> It would then try to copy propagate
>>>>
>>>> LDC 0
>>>> LDA ...
>>>> LDC 8
>>>> MSTORE
>>>>
>>>> to
>>>>
>>>> LDA ...
>>>> LDC 8
>>>> MLOAD
>>>>
>>>> And, it fails to make a CVT op of type I4 and M.
>>>>
>>>> As WOPT is not doing copy propagation for MLOAD, so we just abandon the
>>>> opportunity as a fix.
>>>> It should be noted that, the DEF is passing the "Propagatable" test, as
>>>> it is LDC I4, while usual DEF of an MLOAD would be MLOAD.
>>>>
>>>> The patch is as following:
>>>> Index: opt_prop.cxx
>>>> ===================================================================
>>>> --- opt_prop.cxx (revision 3827)
>>>> +++ opt_prop.cxx (working copy)
>>>> @@ -1307,6 +1307,16 @@
>>>> if (prop == NOT_PROPAGATABLE)
>>>> return NULL;
>>>>
>>>> + // MLOAD may be defined by a MSTORE as following
>>>> + // LDC 0
>>>> + // LDA
>>>> + // LDC
>>>> + // MSTORE
>>>> + // The definition would pass Propagatable test, but we are not going
>>>> + // to propagate it.
>>>> + if (x->Opr() == OPR_MLOAD)
>>>> + return NULL;
>>>> +
>>>> x->DecUsecnt();
>>>> if (icopy_phase)
>>>> Htable()->Inc_inputprops();
>>>>
>>>> Best Regards,
>>>> Yiran
>>>>
>>>>
>>>> ------------------------------------------------------------------------------
>>>> All the data continuously generated in your IT infrastructure
>>>> contains a definitive record of customers, application performance,
>>>> security threats, fraudulent activity, and more. Splunk takes this
>>>> data and makes sense of it. IT sense. And common sense.
>>>> http://p.sf.net/sfu/splunk-novd2d
>>>> _______________________________________________
>>>> Open64-devel mailing list
>>>> Open64-devel@lists.sourceforge.net
>>>> https://lists.sourceforge.net/lists/listinfo/open64-devel
>>>>
>>>>
>>>
>>
>
------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure
contains a definitive record of customers, application performance,
security threats, fraudulent activity, and more. Splunk takes this
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
_______________________________________________
Open64-devel mailing list
Open64-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/open64-devel