Open Quuxplusone opened 13 years ago
Attached foo.ll
(17529 bytes, application/octet-stream): foo.ll: from BlackfinRegisterInfo.cpp
Attached foo.a.s
(41499 bytes, text/plain): Release+Asserts/bin/llc
Attached foo.r.s
(41499 bytes, text/plain): Release/bin/llc
Attached foo.c.s
(41499 bytes, text/plain): clang-Release/bin/llc
They are generated with "llc -O0".
Workaround:
--- a/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
+++ b/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
@@ -2029,9 +2029,9 @@ bool
SelectionDAGBuilder::handleBTSplitSwitchCase(CaseRec& CR,
APInt Range = ComputeRange(LEnd, RBegin);
assert((Range - 2ULL).isNonNegative() &&
"Invalid case distance");
- double LDensity = (double)LSize.roundToDouble() /
+ volatile double LDensity = (double)LSize.roundToDouble() /
(LEnd - First + 1ULL).roundToDouble();
- double RDensity = (double)RSize.roundToDouble() /
+ volatile double RDensity = (double)RSize.roundToDouble() /
(Last - RBegin + 1ULL).roundToDouble();
double Metric = Range.logBase2()*(LDensity+RDensity);
// Should always split in some non-trivial place
Resolved in r129199, thanks!
(In reply to comment #6)
> Resolved in r129199, thanks!
Thanks Chris! A little weird it is!
Between i686-mingw32-clang.exe and x86_64-mingw32-clang.exe, still precision
issue is there.
1st patch is;
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20110411/119441.html
It can revert r129199.
I know it could be generalized.
Does anyone try to compare i686(w/o sse2) and x86_64 on other hosts?
Looks like this code still exists:
// Use volatile double here to avoid excess precision issues on some hosts,
// e.g. that use 80-bit X87 registers.
volatile double LDensity =
(double)LSize.roundToDouble() /
(LEnd - First + 1ULL).roundToDouble();
volatile double RDensity =
(double)RSize.roundToDouble() /
(Last - RBegin + 1ULL).roundToDouble();
volatile double Metric = Range.logBase2()*(LDensity+RDensity);
Can it be fixed with ScaledNumber?
foo.ll
(17529 bytes, application/octet-stream)foo.a.s
(41499 bytes, text/plain)foo.r.s
(41499 bytes, text/plain)foo.c.s
(41499 bytes, text/plain)