This is an archive of the discontinued LLVM Phabricator instance.

PGO][InstrProf] Do not promote count if the exit blocks contains ret instruction
ClosedPublic

Authored by xur on Jul 22 2020, 7:08 PM.

Details

Summary

Skip profile count promotion if any of the ExitBlocks contains a ret
instruction. This is to prevent dumping of incomplete profile -- if the
the loop is a long running loop and dump is called in the middle
of the loop, the result profile is incomplete.

ExitBlocks containing a ret instruction is an indication of a long running
loop -- early exit to error handling code.

Diff Detail

Event Timeline

xur created this revision.Jul 22 2020, 7:08 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 22 2020, 7:08 PM
Herald added subscribers: jfb, hiraditya. · View Herald Transcript
davidxl accepted this revision.Jul 23 2020, 9:19 AM

lgtm

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

Add a //FIXME here to add other heuristics to detect long running loop (runtime infinite), e.g. exit condition etc.

This revision is now accepted and ready to land.Jul 23 2020, 9:19 AM
This revision was automatically updated to reflect the committed changes.