This is an archive of the discontinued LLVM Phabricator instance.

StackProtector: instrument noreturn paths before the call
Needs ReviewPublic

Authored by t.p.northover on Feb 16 2023, 1:24 AM.
This revision needs review, but there are no reviewers specified.

Details

Reviewers
None
Summary

Like the recent IR-level patch, this adds the ability for the stack protector to instrument a noreturn call followed by an unreachable if it's the SelectionDAG logic inserting the checks. This covers the interesting case of a call to _Unwind_Resume (or similar) along an exception cleanup path.

Diff Detail

Event Timeline

t.p.northover created this revision.Feb 16 2023, 1:24 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 16 2023, 1:24 AM
t.p.northover requested review of this revision.Feb 16 2023, 1:24 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 16 2023, 1:24 AM
jrtc27 added inline comments.Feb 16 2023, 1:27 AM
llvm/test/CodeGen/RISCV/stackprotect-noreturn.ll
2

Please use update_llc_test_checks.py, at least for RISC-V, though I'd encourage its use for other architectures too. Also don't use a Linux triple unless it's strictly necessary, a plain riscv32 is normally sufficient, and be sure to test both 32-bit and 64-bit.

jrtc27 added inline comments.Feb 16 2023, 1:32 AM
llvm/test/CodeGen/RISCV/stackprotect-noreturn.ll
2

Also we favour < %s over %s -o - and -verify-machineinstrs tends to be a worthwhile thing to have on tests

Convert RISC-V tests to use their preferred style.