]> granicus.if.org Git - clang/commit
[PGO] Add simplified branch weights for Objective-C for-collection loops.
authorBob Wilson <bob.wilson@apple.com>
Tue, 25 Mar 2014 23:26:31 +0000 (23:26 +0000)
committerBob Wilson <bob.wilson@apple.com>
Tue, 25 Mar 2014 23:26:31 +0000 (23:26 +0000)
commit70f12c60afd1c3fdf2dd8718f734fd06646bf588
tree15b387165c44275ba8dbc5f7e096c451caa9b8a3
parent0733650b60a57b9fab2e1d8b3f26613fd4f46c53
[PGO] Add simplified branch weights for Objective-C for-collection loops.

Conceptually one of these loops is just a while-loop, but the actual code-gen
is more complicated. We don't instrument all the different control flow edges
to get accurate counts for each conditional branch, nor do I think it makes
sense to do so. Instead, make the simplifying assumption that the loop behaves
like a while-loop. Use the same branch weights for the first check for an
empty collection as would be used for the back-edge of a while loop, and use
that same weighting for the innermost loop, ignoring the possibility that there
may be some extra code to go fetch more elements.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@204767 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/CGObjC.cpp
test/Profile/objc-general.m