-
Notifications
You must be signed in to change notification settings - Fork 15.6k
Description
| Bugzilla Link | 9590 |
| Resolution | FIXED |
| Resolved on | Mar 31, 2011 07:13 |
| Version | 2.9 |
| OS | Windows XP |
| Blocks | llvm/llvm-bugzilla-archive#9591 |
| Reporter | LLVM Bugzilla Contributor |
| CC | @stoklund |
Extended Description
$ g++ --version
g++.exe (TDM-1 mingw32) 4.4.0
$ bin/clang++.exe --version
clang version 2.9 (git://github.com/chapuni/clang.git http://llvm.org/git/clang.git ssh://chapuni@192.168.1.193/home/chapuni/clang.git b769bbbda7024bb990e8bad698e414b8e386ba5a)
Target: i686-pc-mingw32
Thread model: posix
--
With g++, std::pow(float,float) aka __builtin_powf() is expanded to pow().
With clang, std::pow(float,float) is still powf().
Due to precision issue, result of -regalloc=linearscan might not be identical.
(I have not tried other regallocs with clang)
Workaround is as below;
--- a/lib/CodeGen/LiveIntervalAnalysis.cpp
+++ b/lib/CodeGen/LiveIntervalAnalysis.cpp
@@ -1703,7 +1703,7 @@ LiveIntervals::getSpillWeight(bool isDef, bool isUse, unsigned loopDepth) {
// overflow a float. This expression behaves like 10^d for small d, but is
// more tempered for large d. At d=200 we get 6.7e33 which leaves a bit of
// headroom before overflow.
- float lc = std::pow(1 + (100.0f / (loopDepth+10)), (float)loopDepth);
-
float lc = ::pow(1 + (100.0f / (loopDepth+10)), (float)loopDepth);
return (isDef + isUse) * lc;
}