]> granicus.if.org Git - clang/commit
CodeGen: Don't create branch weight metadata from empty profiles
authorJustin Bogner <mail@justinbogner.com>
Fri, 4 Apr 2014 02:48:51 +0000 (02:48 +0000)
committerJustin Bogner <mail@justinbogner.com>
Fri, 4 Apr 2014 02:48:51 +0000 (02:48 +0000)
commit6acf9ee0e5e7a18998d81281d81de082a6b4b12a
treebe65818c097a5e6af5eb42a7e745f713d6eb6907
parent871b49abfab90c37ff229b6559ef1c1a4c80b6d6
CodeGen: Don't create branch weight metadata from empty profiles

If all of our weights are zero when calculating branch weights, it
means we haven't profiled the code in question. Avoid creating a
metadata node that says all branches are equally likely in this case.

The test also checks constructs that hit the other createBranchWeights
overload. These were already working.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@205606 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/CodeGenPGO.cpp
test/Profile/Inputs/c-unprofiled-blocks.profdata [new file with mode: 0644]
test/Profile/c-unprofiled-blocks.c [new file with mode: 0644]