diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2017-07-26 22:01:09 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2017-07-26 22:01:09 +0000 |
commit | ba7a7c6997ff5890b91705b1bb53e4e6240d0673 (patch) | |
tree | 7b27030652baef6f75d0a7c449d30d304ed1257b /test/CodeGenCXX/microsoft-abi-static-initializers.cpp | |
parent | a10a6062c4139ef7a144caa138e6aaeae785d2a9 (diff) |
Add branch weights to branches for static initializers.
The initializer for a static local variable cannot be hot, because it runs at
most once per program. That's not quite the same thing as having a low branch
probability, but under the assumption that the function is invoked many times,
modeling this as a branch probability seems reasonable.
For TLS variables, the situation is less clear, since the initialization side
of the branch can run multiple times in a program execution, but we still
expect initialization to be rare relative to non-initialization uses. It would
seem worthwhile to add a PGO counter along this path to make this estimation
more accurate in future.
For globals with guarded initialization, we don't yet apply any branch weights.
Due to our use of COMDATs, the guard will be reached exactly once per DSO, but
we have no idea how many DSOs will define the variable.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@309195 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGenCXX/microsoft-abi-static-initializers.cpp')
-rw-r--r-- | test/CodeGenCXX/microsoft-abi-static-initializers.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/test/CodeGenCXX/microsoft-abi-static-initializers.cpp b/test/CodeGenCXX/microsoft-abi-static-initializers.cpp index 57a72d4e2a..0b84f07e11 100644 --- a/test/CodeGenCXX/microsoft-abi-static-initializers.cpp +++ b/test/CodeGenCXX/microsoft-abi-static-initializers.cpp @@ -146,7 +146,7 @@ inline S &getS() { // CHECK-LABEL: define linkonce_odr dereferenceable({{[0-9]+}}) %struct.S* @"\01?getS@@YAAAUS@@XZ"() {{.*}} comdat // CHECK: load i32, i32* @"\01??_B?1??getS@@YAAAUS@@XZ@51" // CHECK: and i32 {{.*}}, 1 -// CHECK: icmp ne i32 {{.*}}, 0 +// CHECK: icmp eq i32 {{.*}}, 0 // CHECK: br i1 // init: // CHECK: or i32 {{.*}}, 1 |