[PATCH] D104479: [PartiallyInlineLibCalls] Disable sqrt expansion for strictfp.

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 17 14:15:23 PDT 2021


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG99e95856fb78: [PartiallyInlineLibCalls] Disable sqrt expansion for strictfp. (authored by craig.topper).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D104479/new/

https://reviews.llvm.org/D104479

Files:
  llvm/lib/Transforms/Scalar/PartiallyInlineLibCalls.cpp
  llvm/test/Transforms/PartiallyInlineLibCalls/strictfp.ll


Index: llvm/test/Transforms/PartiallyInlineLibCalls/strictfp.ll
===================================================================
--- /dev/null
+++ 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)
Index: llvm/lib/Transforms/Scalar/PartiallyInlineLibCalls.cpp
===================================================================
--- llvm/lib/Transforms/Scalar/PartiallyInlineLibCalls.cpp
+++ 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


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D104479.352842.patch
Type: text/x-patch
Size: 1185 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210617/093b638f/attachment.bin>


More information about the llvm-commits mailing list