Discussion:
[Open64-devel] Code review request for if conversion enhancement
Zhang, Ding Fei
2014-07-01 09:48:55 UTC
Permalink
Hi,

Can a Gatekeeper please review the attached patch for if conversion enhancement?

Below is a brief description for the motivation of this patch. For more design details, please refer to the attached document. Thanks.

current O2 high level if conversion of open64 has some defects. it can't perform safe if conversion for some indirect accesses. for example:

q = p;

if (q)

p->next = sth;
current open64 will wrongly perform if conversion for above case:
q = p;
p->next =(q) ? sth: p->next;
in this case, if p ==NULL, the indirect access p->next is unsafe, which may introduce unexpected exception in transformed code.

Besides the defects, there some cases open64 can't handle. for example:

if (p)

p->next = sth;
in above case, indirect access p->next is guarded by condition p != NULL. Because it needs extra iload access to 'p', which is unsafe, current open64 will abandon if conversion for this case. Actually, if we introduce an extra pointer, we still can perform safe if conversion for this case as below.
P' = (p) ? (p+next) : &dummy;
*p' = sth;

To address these indirect accesses related defects and extend the if conversion of open64 to handle more complex cases, we decide to develop a new if conversion. This new if conversion will be enabled at O1 and above, which may also improve open64's O1 performance.



Best Regards,
Dingfei

Loading...