From 575121d3105100341cf838b793e8fb1fc5cc5ef0 Mon Sep 17 00:00:00 2001 From: David Majnemer Date: Wed, 23 Dec 2015 09:58:43 +0000 Subject: [PATCH] [OperandBundles] Have TailCallElim play nice with operand bundles A call site's use of a Value might not correspond to an argument operand but to a bundle operand. This fixes PR25928. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@256328 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/Scalar/TailRecursionElimination.cpp | 4 ++-- test/Transforms/TailCallElim/basic.ll | 10 ++++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/lib/Transforms/Scalar/TailRecursionElimination.cpp b/lib/Transforms/Scalar/TailRecursionElimination.cpp index 7e1ba2c3c90..0e0b00df85b 100644 --- a/lib/Transforms/Scalar/TailRecursionElimination.cpp +++ b/lib/Transforms/Scalar/TailRecursionElimination.cpp @@ -197,8 +197,8 @@ struct AllocaDerivedValueTracker { case Instruction::Call: case Instruction::Invoke: { CallSite CS(I); - bool IsNocapture = !CS.isCallee(U) && - CS.doesNotCapture(CS.getArgumentNo(U)); + bool IsNocapture = + CS.isDataOperand(U) && CS.doesNotCapture(CS.getDataOperandNo(U)); callUsesLocalStack(CS, IsNocapture); if (IsNocapture) { // If the alloca-derived argument is passed in as nocapture, then it diff --git a/test/Transforms/TailCallElim/basic.ll b/test/Transforms/TailCallElim/basic.ll index fe8bbe9ad03..b303fa743ca 100644 --- a/test/Transforms/TailCallElim/basic.ll +++ b/test/Transforms/TailCallElim/basic.ll @@ -188,3 +188,13 @@ define void @test11() { ; CHECK: call void @test11_helper2 ret void } + +; PR25928 +define void @test12() { +entry: +; CHECK-LABEL: @test12 +; CHECK: {{^ *}} call void undef(i8* undef) [ "foo"(i8* %e) ] + %e = alloca i8 + call void undef(i8* undef) [ "foo"(i8* %e) ] + unreachable +} -- 2.34.1