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