From 6e6b2d493a17bc6bc6a63d80808d0b722b78c8d9 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 llvm-svn: 35834 --- 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);