This is an archive of the discontinued LLVM Phabricator instance.

Fix FunctionPropertiesAnalysis updating callsite in 1-BB loop
ClosedPublic

Authored by mtrofin on Jun 6 2022, 8:53 PM.

Details

Summary

If the callsite is in a single BB loop, we need to exclude the BB from
the successor set (in which it'd be a member), because that set forms a
boundary at which we stop traversing the CFG, when re-ingesting BBs
after inlining; but after inlining, the callsite BB's new successors
should be visited.

Diff Detail

Event Timeline

mtrofin created this revision.Jun 6 2022, 8:53 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 6 2022, 8:53 PM
Herald added a subscriber: hiraditya. · View Herald Transcript
mtrofin requested review of this revision.Jun 6 2022, 8:53 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 6 2022, 8:53 PM
kazu accepted this revision.Jun 7 2022, 2:52 PM

Thank you for the fix. LGTM modulo some rewording of the comment.

llvm/lib/Analysis/FunctionPropertiesAnalysis.cpp
138–142

I understand the motivation and the fix, but I am wondering if we can make the comment a little easier to understand.

// Exclude the CallSiteBB.  finish() traverses the resulting CFG from CallSiteBB                                                                  
// up to and including Successors.  Including the CallSiteBB in Successors would                                                                  
// prematurely stop the traversal when it happens to be its own successor.

Nit: "would prematurely stop the traversal" sounds more natural than "would stop prematurely the traversal".

This revision is now accepted and ready to land.Jun 7 2022, 2:52 PM
This revision was landed with ongoing or failed builds.Jun 8 2022, 2:32 PM
This revision was automatically updated to reflect the committed changes.
mtrofin marked an inline comment as done.Jun 8 2022, 2:32 PM