diff options
| author | Arnold Schwaighofer <aschwaighofer@apple.com> | 2017-11-27 19:03:40 +0000 |
|---|---|---|
| committer | Arnold Schwaighofer <aschwaighofer@apple.com> | 2017-11-27 19:03:40 +0000 |
| commit | d9e710984d169280e613b229974ceea22f7132fc (patch) | |
| tree | 1e3ea47d5a11501c04d9b151917cfa81db943d2d /llvm | |
| parent | 14d7aac15dafa4e2622dd9ba284044977d40363f (diff) | |
| download | bcm5719-llvm-d9e710984d169280e613b229974ceea22f7132fc.tar.gz bcm5719-llvm-d9e710984d169280e613b229974ceea22f7132fc.zip | |
Inliner: Don't mark notail calls with the 'tail' attribute
enum TailCallKind { TCK_None = 0, TCK_Tail = 1, TCK_MustTail = 2,
TCK_NoTail = 3 };
TCK_NoTail is greater than TCK_Tail so taking the min does not do the
correct thing.
rdar://35639547
llvm-svn: 319075
Diffstat (limited to 'llvm')
| -rw-r--r-- | llvm/lib/Transforms/Utils/InlineFunction.cpp | 3 | ||||
| -rw-r--r-- | llvm/test/Transforms/Inline/inline-tail.ll | 15 |
2 files changed, 17 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Utils/InlineFunction.cpp b/llvm/lib/Transforms/Utils/InlineFunction.cpp index 23a72e86e50..15a8bf22922 100644 --- a/llvm/lib/Transforms/Utils/InlineFunction.cpp +++ b/llvm/lib/Transforms/Utils/InlineFunction.cpp @@ -1850,7 +1850,8 @@ bool llvm::InlineFunction(CallSite CS, InlineFunctionInfo &IFI, // f -> g -> musttail f ==> f -> f // f -> g -> tail f ==> f -> f CallInst::TailCallKind ChildTCK = CI->getTailCallKind(); - ChildTCK = std::min(CallSiteTailKind, ChildTCK); + if (ChildTCK != CallInst::TCK_NoTail) + ChildTCK = std::min(CallSiteTailKind, ChildTCK); CI->setTailCallKind(ChildTCK); InlinedMustTailCalls |= CI->isMustTailCall(); diff --git a/llvm/test/Transforms/Inline/inline-tail.ll b/llvm/test/Transforms/Inline/inline-tail.ll index 66a6be7a59b..7b0fe57b68e 100644 --- a/llvm/test/Transforms/Inline/inline-tail.ll +++ b/llvm/test/Transforms/Inline/inline-tail.ll @@ -181,3 +181,18 @@ define i32 @test_mixedret_a(i1 zeroext %b) { %rv = musttail call i32 @test_mixedret_b(i1 zeroext %b) ret i32 %rv } + +declare i32 @donttailcall() + +define i32 @notail() { + %rv = notail call i32 @donttailcall() + ret i32 %rv +} + +; CHECK: @test_notail +; CHECK: notail call i32 @donttailcall +; CHECK: ret +define i32 @test_notail() { + %rv = tail call i32 @notail() + ret i32 %rv +} |

