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)
commitbfb9d435e43a41531720befc94f990c8daa379ff
treeff7531837f900e958848a22f0eef5339de9b2f3a
parent1e46d48814c475503cf8469076949c0523ba1613
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.

llvm-svn: 163954
llvm/lib/Transforms/Utils/SimplifyCFG.cpp
llvm/test/Transforms/SimplifyCFG/preserve-branchweights.ll