This is an archive of the discontinued LLVM Phabricator instance.

[PATCH 2/2] [x86] Add support for "probe-stack"
Needs ReviewPublic

Authored by Zoxc on Aug 30 2015, 1:10 PM.

Details

Reviewers
nadav
majnemer
Summary

This is an alternative to http://reviews.llvm.org/D9654

Stack probes are done in an loop in the prologue instead of calling external functions.

Note that when modifying basic blocks in the emitPrologue the epilog will be inserted into the wrong basic block. This is because
the basic blocks to insert epilogs into is calculated before
emitPrologue is called.
I fixed this by adding the following code after the emitPrologue call
in PEI::insertPrologEpilogCode:

RestoreBlocks.clear();
calculateSets(Fn);

This doesn't seem like a very nice solution.

Another thing is that I'm not sure that I modified all the test for stack probing correctly (there were quite a few cases of it).

Diff Detail

Event Timeline

Zoxc updated this revision to Diff 33544.Aug 30 2015, 1:10 PM
Zoxc retitled this revision from to [PATCH 2/2] [x86] Add support for "probe-stack".
Zoxc updated this object.
Zoxc added a reviewer: majnemer.
Zoxc set the repository for this revision to rL LLVM.
Zoxc added subscribers: qcolombet, llvm-commits.
Zoxc updated this revision to Diff 33643.Aug 31 2015, 4:13 PM
Zoxc removed rL LLVM as the repository for this revision.

Code generation on Windows is preserved in this version.

Zoxc updated this revision to Diff 33652.Aug 31 2015, 5:04 PM

Rebased tests and added a test for variable length stack allocation.

We have some changes coming in our fork (see https://github.com/Microsoft/llvm/pull/79) where for the inline probes we emit a call to a stub during prolog generation, and then we come back later after epilogs are created to expand the probe sequence inline. We should be able to upstream this soon.

This seems cleaner to us then trying to repair state after prolog generation...

Zoxc added a comment.Sep 9 2015, 5:36 PM

Is said state actually used before prolog generation? Just moving the generation to after prolog generation seems like the nicest solution if it's possible.

tamird added a subscriber: tamird.Oct 29 2015, 10:47 AM
Zoxc updated this revision to Diff 45515.Jan 21 2016, 5:14 AM

This now uses the same method as the CoreCLR inline stack probes.

Zoxc added a reviewer: nadav.Mar 26 2016, 1:38 PM
Zoxc updated this revision to Diff 54608.Apr 21 2016, 9:11 PM

Rebased patch.