[ARM] Use BranchProbability::scale() to scale an integer with a probability in ARMBas...
authorCong Hou <congh@google.com>
Wed, 26 Aug 2015 23:17:52 +0000 (23:17 +0000)
committerCong Hou <congh@google.com>
Wed, 26 Aug 2015 23:17:52 +0000 (23:17 +0000)
commitb99373e1a6c8f8c00ed3b6613cdb7f403eb36000
treeb73097bf3ebe66ccbf5f093f33f3070fa9b73297
parent6dc18d8d3a86509edf747a3cddcc0104ef710cc3
[ARM] Use BranchProbability::scale() to scale an integer with a probability in ARMBaseInstrInfo.cpp,

Previously in isProfitableToIfCvt() in ARMBaseInstrInfo.cpp, the multiplication between an integer and a branch probability is done manually in an unsafe way that may lead to overflow. This patch corrects those cases by using BranchProbability's member function scale() to avoid overflow (which stores the intermediate result in int64).

Differential Revision: http://reviews.llvm.org/D12295

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246106 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/ARM/ARMBaseInstrInfo.cpp