This is an archive of the discontinued LLVM Phabricator instance.

Add alloca size threshold for StackTagging initializer merging.
AcceptedPublic

Authored by eugenis on Oct 15 2020, 4:26 PM.

Details

Reviewers
vitalybuka
pcc
Summary

Initializer merging generates pretty inefficient code for large allocas
that also happens to trigger an exponential algorithm somewhere in
Machine Instruction Scheduler. See https://bugs.llvm.org/show_bug.cgi?id=47867.

This change adds an upper limit for the alloca size. The default limit
is selected such that worst case size of memtag-generated code is
similar to non-memtag (but because of the ISA quirks, this case is
realized at the different value of alloca size, ex. memset inlining
triggers at sizes below 512, but stack tagging instructions are 2x
shorter, so limit is approx. 256).

We could try harder to emit more compact code with initializer merging,
but that would only affect large, sparsely initialized allocas, and
those are doing fine already.

Diff Detail

Event Timeline

eugenis created this revision.Oct 15 2020, 4:26 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 15 2020, 4:26 PM
Herald added a subscriber: hiraditya. · View Herald Transcript
eugenis requested review of this revision.Oct 15 2020, 4:26 PM
eugenis updated this revision to Diff 298511.

.

vitalybuka accepted this revision.Oct 19 2020, 1:07 PM
This revision is now accepted and ready to land.Oct 19 2020, 1:07 PM