This is an archive of the discontinued LLVM Phabricator instance.

[X86] Don't use sp as a loop variable in loop stack probing
DraftPublic

Authored by nagisa on Mar 19 2021, 5:59 PM.
This is a draft revision that has not yet been submitted for review.

Details

Reviewers
None
Summary

Modifying the stack pointer during such a loop will result in invalid uwtables. From experiments
done by @YangKao in D98789: [PEI] add dwarf information for stack probe it seems like modifying uwtables for this case is not feasible for
32-bit x86 targets.

This differential approaches this from the other direction – we avoid touching the sp entirely,
except once after the probing loop is over. Instead we allocate (and spill/reload, if necessary)
additional registers to hold loop variables.

This implementation should produce roughly equivalent code when register spills do not occur.

Diff Detail

Event Timeline

nagisa created this revision.Mar 19 2021, 5:59 PM
nagisa updated this revision to Diff 332137.Mar 20 2021, 5:08 PM

Correctly track which registers we need to clobber