This is an archive of the discontinued LLVM Phabricator instance.

[NFC][GuardUtils] Add util to extract widenable conditions
ClosedPublic

Authored by aleksandr.popov on Aug 9 2023, 10:55 AM.

Details

Summary

This is the next preparation patch to support widenable conditions
widening instead of branches widening.

We've added parseWidenableGuard util which parses guard condition and
collects all checks existing in the expression tree: D157276

Here we are adding util which walks similar way through the expression
tree but looks up for widenable condition without collecting the checks.
Therefore llvm::extractWidenableCondition could parse widenable branches
with arbitrary position of widenable condition in the expression tree.

llvm::parseWidenableBranch which is we are going to get rid of is being
replaced by llvm::extractWidenableCondition where it's possible.

Diff Detail

Unit TestsFailed

Event Timeline

Herald added a project: Restricted Project. · View Herald TranscriptAug 9 2023, 10:55 AM
Herald added a subscriber: hiraditya. · View Herald Transcript
aleksandr.popov requested review of this revision.Aug 9 2023, 10:55 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 9 2023, 10:55 AM
anna added inline comments.Aug 9 2023, 12:28 PM
llvm/lib/Analysis/GuardUtils.cpp
130–131

Can you pls rename Callback to recordCheckOrWidenableCond ?

159

Why do you need the oneUse check here? the extractWidenableCondition API and following patches only talk about extracting widenable condition. Pls move this additional check to the patch where this context applies.

aleksandr.popov edited the summary of this revision. (Show Details)
anna accepted this revision.Aug 15 2023, 9:28 AM

LGTM w/ comments.

llvm/lib/Analysis/GuardUtils.cpp
160
llvm/lib/Transforms/Scalar/LoopPredication.cpp
1124
This revision is now accepted and ready to land.Aug 15 2023, 9:28 AM
aleksandr.popov marked an inline comment as done.
aleksandr.popov marked 3 inline comments as done.
This revision was landed with ongoing or failed builds.Aug 18 2023, 8:38 AM
This revision was automatically updated to reflect the committed changes.