PGO: preserve branch-weight metadata when simplifying two branches with a common
authorManman Ren <mren@apple.com>
Sat, 15 Sep 2012 00:39:57 +0000 (00:39 +0000)
committerManman Ren <mren@apple.com>
Sat, 15 Sep 2012 00:39:57 +0000 (00:39 +0000)
commit062986c2f0a020c0652010e3c8549653397048f4
tree120e419524ae376b89f5a68d8480e01ce712ea86
parent3cbd1786ac06fe751dc4b5ad55e75115cb1d51ce
PGO: preserve branch-weight metadata when simplifying two branches with a common
destination.

Updated previous implementation to fix a case not covered:
// PBI: br i1 %x, TrueDest, BB
// BI:  br i1 %y, TrueDest, FalseDest
The other case was handled correctly.
// PBI: br i1 %x, BB, FalseDest
// BI:  br i1 %y, TrueDest, FalseDest

Also tried to use 64-bit arithmetic instead of APInt with scale to simplify the
computation. Let me know if you have other opinions about this.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@163954 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Utils/SimplifyCFG.cpp
test/Transforms/SimplifyCFG/preserve-branchweights.ll