Hi,

 

The following patch aims to address bug #20074, and similar ones.  The
problem is that accesses to elements in constant-sized char arrays end up
annotated with TBAA tags that have base as "omnipotent char", so they'll
alias with pointers other than pointers to char.  This prevents some
optimizations, such as removing redundant loads in bug #20074.  Or in the
case of the attached test cases, it prevents hoisting of loads from loops.
The fix is to change the base type to that of "char" if we know we are
dealing with constant sized char arrays.   In effect, this mimics the
behaviour of aliasing generated for other types of arrays (e.g. the base
type is not the "omnipotent char", but there is a path that eventually leads
to it).  I didn't attempt to address VLAs.

 

Can someone please review?

 

Thanks,

Sanjin

Attachment: tbaa-char-arrays.patch
Description: Binary data

_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to