Hi, All

Can gatekeeper help review this patch?

For attached test case, in foo, *p reference is not alias with a in nystrom
alias analysis.
The problem is when creating alias tag, alias_tag points to blackhole is not
updated correctly.

Alias dump before fix.
  I4INTCONST 2 (0x2) {cgnode 1}
 I4STID 0 <1,51,a> T<4,.predef_I4,4> {line: 1/5} {cgnode 3}
  I4INTCONST 3 (0x3) {cgnode 1}
  U8U8LDID 0 <1,52,p> T<53,anon_ptr.,8> {cgnode 4}
 I4ISTORE 0 T<53,anon_ptr.,8> {line: 1/6} {cgnode 4} {alias_tag 2}
  I4I4LDID 0 <1,51,a> T<4,.predef_I4,4> {cgnode 3}
 I4STID 1 <1,5,.preg_I8> T<4,.predef_I4,4> # $r1 {line: 1/7} {cgnode 5}
 RETURN {line: 1/7}

store to p's alias_tag 2 only points to black hole cg node.
It will not alias with STID a (alias_tag 3), because alias_tag 2 not points
to cg node 3.
Dump result for alias tag.

alias tag 2: points to cg nodes [2]   // black hole
alias tag 3: points to cg nodes [3]   // a
alias tag 5: points to cg nodes [4]    // p

Fix is,
For non-ipa alias analysis, if alias tag points to black hole, make it
points to all global and escaple local.
If ipa can't find the points to, its a ipa analysis bug.

after fix
alias tag 2: points to cg nodes [2, 3, 4]  // points to blackhole, a and p.
alias tag 3: points to cg nodes [3]
alias tag 4: points to cg nodes [2, 3, 4]
alias tag 5: points to cg nodes [4]

Regards
Shi Hui

Attachment: blackhole.patch
Description: Binary data

int *p;
int a;
int foo()
{
  a = 2;
  *p = 3;
  return a;
}

int main()
{
  p = &a;
  return foo();
}
------------------------------------------------------------------------------
vRanger cuts backup time in half-while increasing security.
With the market-leading solution for virtual backup and recovery, 
you get blazing-fast, flexible, and affordable data protection.
Download your free trial now. 
http://p.sf.net/sfu/quest-d2dcopy1
_______________________________________________
Open64-devel mailing list
Open64-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/open64-devel

Reply via email to