This is an archive of the discontinued LLVM Phabricator instance.

[GlobalISel] Port over the SelectionDAG stack protector codegen feature.
ClosedPublic

Authored by aemerson on Mar 8 2021, 10:41 AM.

Details

Summary

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.

Diff Detail

Event Timeline

aemerson created this revision.Mar 8 2021, 10:41 AM
aemerson requested review of this revision.Mar 8 2021, 10:41 AM
arsenm added inline comments.Mar 8 2021, 10:49 AM
llvm/lib/CodeGen/CodeGenCommonISel.cpp
66

Could also have merge/unmerge and the rest of the artifacts

96

.isPhysical()

llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp
3172–3178

There's a simpler version of buildLoad that handles the MMO construction

3229

Ditto

3250

Shouldn't construct local MIRBuilders

paquette added inline comments.Mar 8 2021, 10:59 AM
llvm/include/llvm/CodeGen/CodeGenCommonISel.h
10
24

Nit: Not necessary to say this is a class; we know that from the code.

25

This sentence is kind of a run-on, can you break it down a little?

34

Nit: kill passive voice

Previously, the "stack protector" pre-SelectionDAG IR pass handled stack protector generation.

43
79
114
aemerson updated this revision to Diff 329540.Mar 9 2021, 10:37 PM

Address comments. Remove chunks of the long comment which have been obsolete for a long time.

This revision is now accepted and ready to land.Mar 19 2021, 1:59 PM
This revision was landed with ongoing or failed builds.Oct 4 2021, 9:34 PM
This revision was automatically updated to reflect the committed changes.
llvm/test/CodeGen/AArch64/GlobalISel/irtranslator-delayed-stack-protector.ll