[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 07:13:03 PDT 2022
babrath updated this revision to Diff 420497.
babrath added a comment.
Moving test to X86, updating with update_test_checks.py.
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/X86/musttail.ll
Index: llvm/test/Transforms/PartiallyInlineLibCalls/X86/musttail.ll
===================================================================
--- /dev/null
+++ llvm/test/Transforms/PartiallyInlineLibCalls/X86/musttail.ll
@@ -0,0 +1,14 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
+; 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-LABEL: @foo(
+; CHECK-NEXT: [[R:%.*]] = musttail call double @sqrt(double [[X:%.*]])
+; CHECK-NEXT: ret double [[R]]
+;
+ %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.420497.patch
Type: text/x-patch
Size: 1290 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220405/61a5f4f2/attachment.bin>
More information about the llvm-commits
mailing list