[PATCH] D67415: [GlobalISel] When a tail call is emitted in a block, stop translating it

Jessica Paquette via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 10 14:10:16 PDT 2019


paquette created this revision.
paquette added reviewers: aemerson, arsenm, dsanders.
Herald added subscribers: Petar.Avramovic, volkan, hiraditya, kristof.beyls, rovka, wdng.
Herald added a project: LLVM.

This fixes a crash in tail call translation caused by assume and lifetime_end intrinsics.

It's possible to have instructions other than a return after a tail call which will still have `Analysis::isInTailCallPosition` return true. (Namely, lifetime_end and assume intrinsics.)

If we emit a tail call instruction, we should stop translating instructions in the block. Otherwise, we can end up emitting an extra return, or dead instructions in general. This makes the verifier unhappy, and is generally unfortunate for codegen.

This also removes the code from AArch64CallLowering that checks if we have a tail call when lowering a return. This is covered by the new code now.

Also update call-translator-tail-call.ll to show that we now properly tail call in the presence of lifetime_end and assume.


https://reviews.llvm.org/D67415

Files:
  llvm/include/llvm/CodeGen/GlobalISel/IRTranslator.h
  llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp
  llvm/lib/Target/AArch64/AArch64CallLowering.cpp
  llvm/test/CodeGen/AArch64/GlobalISel/call-translator-tail-call.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D67415.219600.patch
Type: text/x-patch
Size: 4658 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190910/04c1224e/attachment.bin>


More information about the llvm-commits mailing list