[PATCH] LLVM CFL Alias Analysis -- Algorithm

George Burgess IV gbiv at google.com
Thu Aug 7 11:40:36 PDT 2014


Hi! Thanks for your comments :)

> Kevin posted this http://comments.gmane.org/gmane.comp.compilers.llvm.devel/75298.
AFAICT, that's not a valid C program. The C89 standard section 3.1.2.6 says "All declarations that refer to the same object or function shall have compatible type; otherwise the behavior is undefined." In this case, the types int and `struct heap` are not compatible. So, undefined behavior results. For more on type compatibility in C89, see section 3.1.2.6 of the standard. Compiling the executable with `-fno-strict-aliasing -O2` on gcc 4.8.2 & clang 3.4.1, it seems that they both produce *very* similar assembly. In terms of pure instruction count, clang actually "wins" by a single instruction. 

> Will this new design supporting "strict aliasing" finally?
This AA algorithm entirely ignores types at the moment. That being said, if we have an API that allows us to extract C/C++ types from LLVM IR, I don't see adding type sensitivity being a necessarily difficult task. (If you're only looking for a pass that deals with types, then you may find that the TypeBasedAliasAnalysis pass interesting.)

Thanks again,
George

http://reviews.llvm.org/D4551






More information about the llvm-commits mailing list