[cfe-dev] optimizations done on ASTs

Douglas Gregor dgregor at apple.com
Fri Sep 9 09:09:17 PDT 2011


On Sep 9, 2011, at 8:44 AM, Bin Zeng wrote:

> Hi all,
> 
> Just a quick question. What optimizations are done on ASTs in clang? By scanning the code, I did not find any optimizations done directly on ASTs. Shortly after preprocessed code is parsed in ParseAST.cpp, it is translated into bitcode which lots of optimizations manipulate. If any, please point me to the right direction.


Clang does not perform an optimization on ASTs. The ASTs describe the code as written in the source file, augmented with semantic information (types, implicit conversions, etc.) describing the actual behavior. The AST -> IR lowering performs some simple optimizations, but the real optimization work is performed on the IR.

	- Doug



More information about the cfe-dev mailing list