Scaling up values in ARMBaseInstrInfo::isProfitableToIfCvt() before they are scaled...
authorCong Hou <congh@google.com>
Fri, 18 Sep 2015 18:19:40 +0000 (18:19 +0000)
committerCong Hou <congh@google.com>
Fri, 18 Sep 2015 18:19:40 +0000 (18:19 +0000)
commit759d988de368e4adf535390b0416c5264620419e
tree1865009ff5ec236ceee20043476db60c3a0e7ccb
parent8aa8c4d086665f178ff8ea9067ab9cacfd4b7a7e
Scaling up values in ARMBaseInstrInfo::isProfitableToIfCvt() before they are scaled by a probability to avoid precision issue.

In ARMBaseInstrInfo::isProfitableToIfCvt(), there is a simple cost model in which the number of cycles is scaled by a probability to estimate the cost. However, when the number of cycles is small (which is usually the case), there is a precision issue after the computation. To avoid this issue, this patch scales those cycles by 1024 (chosen to make the multiplication a litter faster) before they are scaled by the probability. Other variables are also scaled up for the final comparison.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@248018 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/ARM/ARMBaseInstrInfo.cpp
test/CodeGen/ARM/2013-10-11-select-stalls.ll
test/CodeGen/ARM/ifcvt4.ll
test/CodeGen/ARM/sjlj-prepare-critical-edge.ll
test/CodeGen/ARM/test-sharedidx.ll
test/CodeGen/Thumb2/thumb2-ifcvt1.ll