This is an archive of the discontinued LLVM Phabricator instance.

[Windows] Replace TrapUnreachable with an int3 insertion pass
ClosedPublic

Authored by rnk on Sep 4 2019, 4:37 PM.

Details

Summary

This is an alternative to D66980, which was reverted. Instead of
inserting a pseudo instruction that optionally expands to nothing, add a
pass that inserts int3 when appropriate after basic block layout.

Diff Detail

Repository
rL LLVM

Event Timeline

rnk created this revision.Sep 4 2019, 4:37 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 4 2019, 4:37 PM
hans accepted this revision.Sep 5 2019, 5:38 AM

lgtm. I only know about this from what rnk told me about the unwinder not wanting the return address to be outside the function, and this seems like a straight-forward solution to that problem.

llvm/lib/Target/X86/X86.h
85 ↗(On Diff #218810)

Maybe mention briefly that this is in order not to confuse certain unwinders? Otherwise this describes perfectly the "what" but not the "why".

This revision is now accepted and ready to land.Sep 5 2019, 5:38 AM
rnk marked an inline comment as done.Sep 9 2019, 2:05 PM

Thanks!

This revision was automatically updated to reflect the committed changes.