wopt do not deal with ASM stmts
Sun
On Sat, Dec 17, 2011 at 5:26 PM, Gang Yu <yugang...@gmail.com> wrote:
> Goal of this fix is not to handle ASM_INPUT, rather the condition simplify.
>
> Regards
> Gang
>
>
> On Sat, Dec 17, 2011 at 5:24 PM, Sun Chan <sun.c...@gmail.com> wrote:
>
>> Also, I don't believe we ever designed WOPT to deal with ASM statements.
>> To teach various phase to optimize asm stmt in wopt is not the goal.
>> Sun
>>
>> On Sat, Dec 17, 2011 at 5:23 PM, Sun Chan <sun.c...@gmail.com> wrote:
>>
>>> if at O0, gcc optimized it, why is it the case different at O2?
>>> Sun
>>>
>>> On Sat, Dec 17, 2011 at 5:18 PM, Gang Yu <yugang...@gmail.com> wrote:
>>>
>>>> For your questions:
>>>> [1]. why the assertion,
>>>> asm volatile ("%0" : : "i#*X"(x)); is a wrong assembler statement,
>>>> it should be DCEed by optimizer and should not exist in CG phase.
>>>>
>>>> [2]. in order to get DCE. we should make condition
>>>> _builtin_constant_p (x)
>>>> && x != 0
>>>> be folded to constant 0, intrinsic_op _builtin_constant_p(x) should be
>>>> simplified to 0 and then let the optimizer further optimized
>>>> _builtin_constant_p (x)
>>>> && x != 0
>>>> to 0
>>>>
>>>> [3]. at phase O0, _builtin_constant_p(x) is already folded to 0 by gcc.
>>>> and the original case, with the __OPTIMIZE__ macro will not be enabled.
>>>>
>>>> Regards
>>>> Gang
>>>>
>>>>
>>>> On Sat, Dec 17, 2011 at 5:11 PM, Sun Chan <sun.c...@gmail.com> wrote:
>>>>
>>>>> Pls send more info for me to adequately review this fix.
>>>>> Why do you suggest this fix. What is the problem with the assertion.
>>>>> If you do that at -O0, what would happen?
>>>>> Sun
>>>>>
>>>>> On Sat, Dec 17, 2011 at 12:52 AM, Gang Yu <yugang...@gmail.com>wrote:
>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> Could a gatekeeper please help review the fix for bug595(
>>>>>> https://bugs.open64.net/show_bug.cgi?id=595)?
>>>>>>
>>>>>> bug case:
>>>>>>
>>>>>> extern void doit(int);
>>>>>> void
>>>>>> quick_doit(int x)
>>>>>> {
>>>>>> if (__builtin_constant_p (x)
>>>>>> && x != 0)
>>>>>> asm volatile ("%0" : : "i#*X"(x));
>>>>>> else
>>>>>> doit(x);
>>>>>> }
>>>>>> Compiling quick_doit(0)
>>>>>> "bug595.c", line 9: Error: Invalid 'asm' constrain : Cannot find
>>>>>> immediate operand for ASM
>>>>>> opencc ERROR:
>>>>>> /fc/proj/ctires/open64/o64guru/OPEN64_X86_DBG/LATEST/bits//lib/gcc-lib/x86_64-open64-linux/5.0/be
>>>>>> returned non-zero status 4
>>>>>> Analysis:
>>>>>> __builtin_constant_p(x) && x !=0 should be directly folded to if 0(it
>>>>>> did not), then DCE does unreachable elimination, which finally sent out
>>>>>> "doit" to CG.
>>>>>>
>>>>>> Suggested fix:
>>>>>> index 148c4e2..42f55fb 100644
>>>>>> --- a/osprey/be/opt/opt_htable.cxx
>>>>>> +++ b/osprey/be/opt/opt_htable.cxx
>>>>>> @@ -3575,7 +3575,9 @@ CODEMAP::Add_expr(WN *wn, OPT_STAB *opt_stab,
>>>>>> STMTREP *stmt, CANON_CR *ccr,
>>>>>> ccr->Set_tree(NULL);
>>>>>> ccr->Set_scale(retv->Const_val());
>>>>>> retv->DecUsecnt();
>>>>>> - return FALSE;
>>>>>> + // bug595 open64.net. intrinsic op folded to compile
>>>>>> constant
>>>>>> + // should be marked propogated for further
>>>>>> fold/optimizations.
>>>>>> + return TRUE;
>>>>>> }
>>>>>> if (retv->Kind() == CK_RCONST) {
>>>>>> ccr->Set_tree(retv);
>>>>>> Would a gatekeeper help the review? thanks
>>>>>> Regards
>>>>>> Gang
>>>>>>
>>>>>>
>>>>>> ------------------------------------------------------------------------------
>>>>>> Learn Windows Azure Live! Tuesday, Dec 13, 2011
>>>>>> Microsoft is holding a special Learn Windows Azure training event for
>>>>>> developers. It will provide a great way to learn Windows Azure and
>>>>>> what it
>>>>>> provides. You can attend the event by watching it streamed LIVE
>>>>>> online.
>>>>>> Learn more at http://p.sf.net/sfu/ms-windowsazure
>>>>>> _______________________________________________
>>>>>> Open64-devel mailing list
>>>>>> Open64-devel@lists.sourceforge.net
>>>>>> https://lists.sourceforge.net/lists/listinfo/open64-devel
>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>
>
------------------------------------------------------------------------------
Learn Windows Azure Live! Tuesday, Dec 13, 2011
Microsoft is holding a special Learn Windows Azure training event for
developers. It will provide a great way to learn Windows Azure and what it
provides. You can attend the event by watching it streamed LIVE online.
Learn more at http://p.sf.net/sfu/ms-windowsazure
_______________________________________________
Open64-devel mailing list
Open64-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/open64-devel