[PATCH] D82085: [TRE] markTails marks call sites as tailcalls though some of them are not.

Alexey Lapshin via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 18 05:57:21 PDT 2020


avl created this revision.
avl added reviewers: efriedma, jdoerfert, fhahn.
avl added a project: LLVM.
Herald added subscribers: cfe-commits, kerbowa, dmgreen, hiraditya, nhaehnle, jvesely.
Herald added a project: clang.

markTails function set IsTailcall bit for functions which are not
last calls:

define void @test16(i32 %X) {

  tail call void @noarg() <<<<<<<<<<<<<<<<<<<<<<
  %DUMMY = add i32 %X, 1
  tail call void @noarg()
  ret void

}

This is incompatible with tailcall definition:
https://llvm.org/docs/CodeGenerator.html#tail-call-section.

The fix is to add check that tailcall is always last call instruction.
Additionally, the patch removes handling tailcalls from TRE,
since tail recursion calls are not always tailcalls. Specifically,
AllCallsAreTailCalls should not be pre-requisite for TRE.

The patch touches many test files.
The real changes are not so huge and
are all located in TailRecursionElimination.cpp.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D82085

Files:
  clang/test/CodeGen/aarch64-bf16-ldst-intrinsics.c
  clang/test/CodeGen/arm-mve-intrinsics/vmaxaq.c
  clang/test/CodeGen/arm-mve-intrinsics/vmaxnmaq.c
  clang/test/CodeGen/arm-mve-intrinsics/vmaxnmq.c
  clang/test/CodeGen/arm-mve-intrinsics/vmaxq.c
  clang/test/CodeGen/arm-mve-intrinsics/vminaq.c
  clang/test/CodeGen/arm-mve-intrinsics/vminnmaq.c
  clang/test/CodeGen/arm-mve-intrinsics/vminnmq.c
  clang/test/CodeGen/arm-mve-intrinsics/vminq.c
  clang/test/CodeGen/arm64-mte.c
  clang/test/CodeGen/builtins-multiprecision.c
  clang/test/CodeGen/builtins-systemz-zvector-constrained.c
  clang/test/CodeGen/builtins-systemz-zvector.c
  clang/test/CodeGen/builtins-systemz-zvector2-constrained.c
  clang/test/CodeGen/builtins-systemz-zvector2.c
  clang/test/CodeGen/cmse-clear-fp16.c
  clang/test/CodeGen/inline-asm-x86-flag-output.c
  clang/test/CodeGen/ms-intrinsics-other.c
  clang/test/CodeGen/ms-intrinsics.c
  clang/test/CodeGen/systemz-inline-asm.c
  clang/test/CodeGenCXX/ARM/exception-alignment.cpp
  clang/test/CodeGenCXX/RelativeVTablesABI/dynamic-cast.cpp
  clang/test/CodeGenCXX/RelativeVTablesABI/member-function-pointer.cpp
  clang/test/CodeGenCXX/RelativeVTablesABI/type-info.cpp
  clang/test/CodeGenCXX/RelativeVTablesABI/virtual-function-call.cpp
  clang/test/CodeGenCXX/sizeof-unwind-exception.cpp
  clang/test/CodeGenObjCXX/arc-cxx11-init-list.mm
  clang/test/CodeGenOpenCL/amdgcn-flat-scratch-name.cl
  clang/test/CodeGenOpenCL/builtins-amdgcn.cl
  clang/test/CodeGenOpenCL/builtins-generic-amdgcn.cl
  clang/test/CodeGenOpenCL/builtins-r600.cl
  clang/test/CodeGenOpenCL/convergent.cl
  clang/test/CodeGenOpenCL/spir-calling-conv.cl
  llvm/lib/Transforms/Scalar/TailRecursionElimination.cpp
  llvm/test/CodeGen/AMDGPU/amdgpu-inline.ll
  llvm/test/CodeGen/BPF/CORE/intrinsic-transforms.ll
  llvm/test/Transforms/Coroutines/coro-retcon-alloca.ll
  llvm/test/Transforms/PhaseOrdering/X86/vector-reductions-expanded.ll
  llvm/test/Transforms/PhaseOrdering/inlining-alignment-assumptions.ll
  llvm/test/Transforms/TailCallElim/accum_recursion.ll
  llvm/test/Transforms/TailCallElim/basic.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D82085.271678.patch
Type: text/x-patch
Size: 125779 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200618/ca49c692/attachment-0001.bin>


More information about the cfe-commits mailing list