From: David Bolvansky Date: Tue, 2 Jul 2019 21:16:34 +0000 (+0000) Subject: [NFC] Strenghten isInteger condition for rL364940 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=469bb59e0b42ae20e227113679bf5ae75e90d3f9;p=llvm [NFC] Strenghten isInteger condition for rL364940 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@364969 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Transforms/Utils/SimplifyLibCalls.cpp b/lib/Transforms/Utils/SimplifyLibCalls.cpp index 79b1b862e65..54961f375d8 100644 --- a/lib/Transforms/Utils/SimplifyLibCalls.cpp +++ b/lib/Transforms/Utils/SimplifyLibCalls.cpp @@ -1543,8 +1543,9 @@ Value *LibCallSimplifier::optimizePow(CallInst *Pow, IRBuilder<> &B) { APSInt IntExpo(32, /*isUnsigned=*/false); // powf(x, C) -> powi(x, C) iff C is a constant signed integer value - if (ExpoF->convertToInteger(IntExpo, APFloat::rmTowardZero, &Ignored) == - APFloat::opOK) { + if (ExpoF->isInteger() && + ExpoF->convertToInteger(IntExpo, APFloat::rmTowardZero, &Ignored) == + APFloat::opOK) { return createPowWithIntegerExponent( Base, ConstantInt::get(B.getInt32Ty(), IntExpo), M, B); }