Page MenuHomePhabricator

[PGO] Attach appropriate funclet operand bundles to value profiling instrumentation calls
ClosedPublic

Authored by chris.chrulski on Jan 22 2020, 12:48 PM.

Details

Summary

When generating value profiling instrumentation, ensure the call gets the
correct funclet token, otherwise WinEHPrepare will turn the call (and all
subsequent instructions) into unreachable.

Diff Detail

Event Timeline

Herald added a project: Restricted Project. · View Herald TranscriptJan 22 2020, 12:48 PM
Herald added a subscriber: hiraditya. · View Herald Transcript
rnk added a comment.Jan 22 2020, 2:41 PM

Code makes sense and tests look good, but I have a suggestion for how to make it simpler.

llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
875–879

The underlying invariant is that non-intrinsic calls will carry funclet bundles. Intrinsic calls do not. Rather than special casing memop size instrumentation, I think it would be better to:

  • always calculate colors
  • below, use the funclet bundle directly when instrumenting non-intrinsic calls
  • use the color map when instrumenting intrinsic calls (memops)

This logic will be less fragile in the face of future value profiling kinds.

Can you extract Window's specific code into its own helper function if possible?

llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp
642

Add some comment here about the change.

Thanks. Good suggestions for making this more robust.

Moved logic into support routine, and made it less specific to value profiling of memintrinsics calls.

ok with me if Reid is ok with windows specific logic.

rnk accepted this revision.Jan 23 2020, 12:02 PM

lgtm

This revision is now accepted and ready to land.Jan 23 2020, 12:02 PM
This revision was automatically updated to reflect the committed changes.