summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar/PartiallyInlineLibCalls.cpp
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2014-08-01 23:21:21 +0000
committerPeter Collingbourne <peter@pcc.me.uk>2014-08-01 23:21:21 +0000
commite52646cd802fa38471bfed3740ab3377d9da0687 (patch)
treef03a0ba7674af39ca1484e08e768a9339692a134 /llvm/lib/Transforms/Scalar/PartiallyInlineLibCalls.cpp
parent3da117d272079f9dd1937856df3fcd1698803c98 (diff)
downloadbcm5719-llvm-e52646cd802fa38471bfed3740ab3377d9da0687.tar.gz
bcm5719-llvm-e52646cd802fa38471bfed3740ab3377d9da0687.zip
PartiallyInlineLibCalls: Check sqrt result type before transforming it.
Some configure scripts declare this with the wrong prototype, which can lead to an assertion failure. llvm-svn: 214593
Diffstat (limited to 'llvm/lib/Transforms/Scalar/PartiallyInlineLibCalls.cpp')
-rw-r--r--llvm/lib/Transforms/Scalar/PartiallyInlineLibCalls.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Scalar/PartiallyInlineLibCalls.cpp b/llvm/lib/Transforms/Scalar/PartiallyInlineLibCalls.cpp
index 7cce89e0627..5c8bed585b6 100644
--- a/llvm/lib/Transforms/Scalar/PartiallyInlineLibCalls.cpp
+++ b/llvm/lib/Transforms/Scalar/PartiallyInlineLibCalls.cpp
@@ -108,6 +108,10 @@ bool PartiallyInlineLibCalls::optimizeSQRT(CallInst *Call,
if (Call->onlyReadsMemory())
return false;
+ // The call must have the expected result type.
+ if (!Call->getType()->isFloatingPointTy())
+ return false;
+
// Do the following transformation:
//
// (before)
OpenPOWER on IntegriCloud