1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 19:12:56 +02:00

[SimplifyLibCalls] handle pow(x,-0.0) before it can assert (PR43233)

https://bugs.llvm.org/show_bug.cgi?id=43233

llvm-svn: 371221
This commit is contained in:
Sanjay Patel 2019-09-06 16:10:18 +00:00
parent 140b114cf3
commit 8124173364
2 changed files with 12 additions and 2 deletions

View File

@ -1562,8 +1562,8 @@ Value *LibCallSimplifier::optimizePow(CallInst *Pow, IRBuilder<> &B) {
if (match(Expo, m_SpecificFP(-1.0)))
return B.CreateFDiv(ConstantFP::get(Ty, 1.0), Base, "reciprocal");
// pow(x, 0.0) -> 1.0
if (match(Expo, m_SpecificFP(0.0)))
// pow(x, +/-0.0) -> 1.0
if (match(Expo, m_AnyZeroFP()))
return ConstantFP::get(Ty, 1.0);
// pow(x, 1.0) -> x

View File

@ -223,3 +223,13 @@ define <4 x float> @test_simplify_3_5(<4 x float> %x) {
ret <4 x float> %1
}
; Make sure that -0.0 exponent is always simplified.
define double @PR43233(double %x) {
; CHECK-LABEL: @PR43233(
; CHECK-NEXT: ret double 1.000000e+00
;
%r = call fast double @llvm.pow.f64(double %x, double -0.0)
ret double %r
}