[PATCH] D123116: Don't partially inline a musttail libcall.

Bert Abrath via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 5 06:48:52 PDT 2022


babrath updated this revision to Diff 420490.
babrath edited the summary of this revision.
babrath added a comment.

Adding test, using opt instead of llc.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D123116

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


Index: llvm/test/Transforms/PartiallyInlineLibCalls/musttail.ll
===================================================================
--- /dev/null
+++ llvm/test/Transforms/PartiallyInlineLibCalls/musttail.ll
@@ -0,0 +1,10 @@
+; 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 double @foo(double %x) {
+  ; CHECK: call {{.*}} @sqrt
+  %r = musttail call double @sqrt(double %x)
+  ret double %r
+}
+
+declare double @sqrt(double)
Index: llvm/lib/Transforms/Scalar/PartiallyInlineLibCalls.cpp
===================================================================
--- llvm/lib/Transforms/Scalar/PartiallyInlineLibCalls.cpp
+++ llvm/lib/Transforms/Scalar/PartiallyInlineLibCalls.cpp
@@ -125,6 +125,9 @@
       if (Call->isNoBuiltin() || Call->isStrictFP())
         continue;
 
+      if (Call->isMustTailCall())
+        continue;
+
       // Skip if function either has local linkage or is not a known library
       // function.
       LibFunc LF;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D123116.420490.patch
Type: text/x-patch
Size: 1102 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220405/a57850a7/attachment.bin>


More information about the llvm-commits mailing list