diff --git a/llvm/lib/Transforms/Scalar/PartiallyInlineLibCalls.cpp b/llvm/lib/Transforms/Scalar/PartiallyInlineLibCalls.cpp --- a/llvm/lib/Transforms/Scalar/PartiallyInlineLibCalls.cpp +++ b/llvm/lib/Transforms/Scalar/PartiallyInlineLibCalls.cpp @@ -121,7 +121,7 @@ if (!Call || !(CalledFunc = Call->getCalledFunction())) continue; - if (Call->isNoBuiltin()) + if (Call->isNoBuiltin() || Call->isStrictFP()) continue; // Skip if function either has local linkage or is not a known library diff --git a/llvm/test/Transforms/PartiallyInlineLibCalls/strictfp.ll b/llvm/test/Transforms/PartiallyInlineLibCalls/strictfp.ll new file mode 100644 --- /dev/null +++ b/llvm/test/Transforms/PartiallyInlineLibCalls/strictfp.ll @@ -0,0 +1,12 @@ +; RUN: opt -S -partially-inline-libcalls -mtriple=x86_64-unknown-linux-gnu < %s | FileCheck %s +; RUN: opt -S -passes=partially-inline-libcalls -mtriple=x86_64-unknown-linux-gnu < %s | FileCheck %s + +define float @f(float %val) strictfp { +; CHECK-LABEL: @f +; CHECK: call{{.*}}@sqrtf +; CHECK-NOT: call{{.*}}@sqrtf + %res = tail call float @sqrtf(float %val) strictfp + ret float %res +} + +declare float @sqrtf(float)