From 54e2b142be6ac759e87dde8a643a7beaff0365df Mon Sep 17 00:00:00 2001 From: Anton Korobeynikov Date: Mon, 9 Apr 2007 21:57:03 +0000 Subject: [PATCH] Use integer log for metric calculation git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35834 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp index cd61d111d22..e1a8c296b66 100644 --- a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp +++ b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp @@ -1604,7 +1604,7 @@ bool SelectionDAGLowering::handleBTSplitSwitchCase(CaseRec& CR, assert((RBegin-LEnd>=1) && "Invalid case distance"); double LDensity = (double)LSize / (double)((LEnd - First) + 1ULL); double RDensity = (double)RSize / (double)((Last - RBegin) + 1ULL); - double Metric = log(double(RBegin-LEnd))*(LDensity+RDensity); + double Metric = Log2_64(RBegin-LEnd)*(LDensity+RDensity); // Should always split in some non-trivial place DOUT <<"=>Step\n" << "LEnd: " << LEnd << ", RBegin: " << RBegin << "\n" @@ -1620,7 +1620,7 @@ bool SelectionDAGLowering::handleBTSplitSwitchCase(CaseRec& CR, RSize -= J->size(); } // If our case is dense we *really* should handle it earlier! - assert((FMetric != 0) && "Should handle dense range earlier!"); + assert((FMetric > 0) && "Should handle dense range earlier!"); CaseRange LHSR(CR.Range.first, Pivot); CaseRange RHSR(Pivot, CR.Range.second);