Nema, Ashutosh via llvm-dev
2015-Sep-22 10:37 UTC
[llvm-dev] Alias set with only one element having may-alias property
Looks like missing some basics here. Consider following test: 1 int escape(int **ptr); 2 int foo(int * ptr) 3 { 4 return escape(&ptr); 5 } At line number 4 address of pointer passed to another routine. When I print alias set: Alias Set Tracker: 1 alias sets for 1 pointer values. AliasSet[0x43be490, 2] may alias, Mod/Ref Pointers: (i32** %ptr.addr, 8) 1 Unknown instructions: i32 %call Here ptr.addr is only in the set, and set property is may-alias. I'm not sure it may-alias with what, if its aliasing with self then why not must-alias ? Is may-alias indicating ptr.addr is unsafe to optimize, and it can possibly alias with something. Regards, Ashutosh -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150922/ca9af4ec/attachment.html>
Hal Finkel via llvm-dev
2015-Nov-09 21:26 UTC
[llvm-dev] Alias set with only one element having may-alias property
----- Original Message -----> From: "Ashutosh via llvm-dev Nema" <llvm-dev at lists.llvm.org> > To: "llvm-dev" <llvm-dev at lists.llvm.org> > Sent: Tuesday, September 22, 2015 5:37:48 AM > Subject: [llvm-dev] Alias set with only one element having may-alias property > > Looks like missing some basics here. > > Consider following test: > > 1 int escape(int **ptr); > 2 int foo(int * ptr) > 3 { > 4 return escape(&ptr); > 5 } > > At line number 4 address of pointer passed to another routine. > > When I print alias set: > > Alias Set Tracker: 1 alias sets for 1 pointer values. > AliasSet[0x43be490, 2] may alias, Mod/Ref Pointers: (i32** %ptr.addr, > 8) > 1 Unknown instructions: i32 %call > > Here ptr.addr is only in the set, and set property is may-alias. > > I’m not sure it may-alias with what, if its aliasing with self then > why not must-alias ? > > Is may-alias indicating ptr.addr is unsafe to optimize, and it can > possibly alias with something.Regarding optimization, this depends on how the AST is used. But, if other pointer accesses are found that might alias with %ptr.addr, then Mod/Ref seems like a default state for the alias set given the unknown behavior of 'int escape(int **ptr)'. -Hal> > Regards, > Ashutosh > > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >-- Hal Finkel Assistant Computational Scientist Leadership Computing Facility Argonne National Laboratory