The boost example, #include <boost/multiprecision/cpp_bin_float.hpp> #include <boost/math/special_functions/gamma.hpp> #include <iostream> int main() { using namespace boost::multiprecision; std::cout << boost::math::tgamma(cpp_bin_float_100(1000)) << std::endl; } produce correct output bin/clang++ -O2 -std=c++11 -isystem include cpp_bin_float_snips.cpp ./a.out 4.02387e+2564 with pre-r248638 clang and gcc 5.1.0. From r248638, ./a.out terminate called after throwing an instance of 'boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<std::range_error> >' what(): No bits were set in the operand. this is on Ubunto 14.04 64 bit, boost 1.57.
I think this is a glitch with how isIdenticalTo is used in ScalarEvolution. Can you check if clang built with this patch below fixes the issue? diff --git a/lib/Analysis/ScalarEvolution.cpp b/lib/Analysis/ScalarEvolution.cpp index 32d3d36..bfd6c45 100644 --- a/lib/Analysis/ScalarEvolution.cpp +++ b/lib/Analysis/ScalarEvolution.cpp @@ -6418,7 +6418,8 @@ static bool HasSameValue(const SCEV *A, const SCEV *B) { if (const SCEVUnknown *BU = dyn_cast<SCEVUnknown>(B)) if (const Instruction *AI = dyn_cast<Instruction>(AU->getValue())) if (const Instruction *BI = dyn_cast<Instruction>(BU->getValue())) - if (AI->isIdenticalTo(BI) && !AI->mayReadFromMemory()) + if (AI->isIdenticalTo(BI) && !AI->mayReadFromMemory() && + !isa<AllocaInst>(AI)) return true; // Otherwise assume they may have a different value.
Yes, this patch does solve the problem. Thanks for looking into this!
Should be fixed in r248690
Confirmed, r248690 fixes the problem.