[GlobalISel] Port over the SelectionDAG stack protector codegen feature.
authorAmara Emerson <amara@apple.com>
Sun, 26 Sep 2021 05:55:37 +0000 (22:55 -0700)
committerAmara Emerson <amara@apple.com>
Tue, 5 Oct 2021 04:33:44 +0000 (21:33 -0700)
commitcfef1803dd83fc2447c295742710a09e8e17aa22
tree7b30657e26d5471548fb26d4820b363dbaca5509
parent31a5cb3292e1167ed9f285a1a29463f2c5fe6bbf
[GlobalISel] Port over the SelectionDAG stack protector codegen feature.

This is a port of the feature that allows the StackProtector pass to omit
checking code for stack canary checks, and rely on SelectionDAG to do it at a
later stage. The reasoning behind this seems to be to prevent the IR checking
instructions from hindering tail-call optimizations during codegen.

Here we allow GlobalISel to also use that scheme. Doing so requires that we
do some analysis using some factored-out code to determine where to generate
code for the epilogs.

Not every case is handled in this patch since we don't have support for all
targets that exercise different stack protector schemes.

Differential Revision: https://reviews.llvm.org/D98200
llvm/include/llvm/CodeGen/CodeGenCommonISel.h [new file with mode: 0644]
llvm/include/llvm/CodeGen/GlobalISel/IRTranslator.h
llvm/lib/CodeGen/CMakeLists.txt
llvm/lib/CodeGen/CodeGenCommonISel.cpp [new file with mode: 0644]
llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp
llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h
llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
llvm/lib/CodeGen/StackProtector.cpp
llvm/test/CodeGen/AArch64/GlobalISel/irtranslator-delayed-stack-protector.ll [new file with mode: 0644]
llvm/test/CodeGen/AArch64/GlobalISel/irtranslator-stackprotect-check.ll [deleted file]