diff options
Diffstat (limited to 'llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp b/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp index 79b1b86..54961f3 100644 --- a/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp +++ b/llvm/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); } |