Eliminate the branching in QualType::getTypePtr() by providing a
common base for ExtQuals and Type that stores the underlying type pointer. This results in a 2% performance win for -emit-llvm on a typical C file, with 1% memory growth in the AST. Note that there is an API change in this optimization: QualType::getTypePtr() can no longer be invoked on a NULL QualType. If the QualType might be NULL, use QualType::getTypePtrOrNull(). I've audited all uses of getTypePtr() in the code base and changed the appropriate uses over to getTypePtrOrNull(). A future optimization opportunity would be to distinguish between cast/dyn_cast and cast_or_null/dyn_cast_or_null; for the former, we could use getTypePtr() rather than getTypePtrOrNull(), to take another branch out of the cast/dyn_cast implementation. llvm-svn: 121489
Loading
Please register or sign in to comment