This is an archive of the discontinued LLVM Phabricator instance.

[SCEV] Use isKnownPredicateAt in isLoopBackedgeGuardedByCond
ClosedPublic

Authored by mkazantsev on Nov 25 2020, 10:01 PM.

Details

Summary

A piece of code in isLoopBackedgeGuardedByCond basically duplicates
the dominators traversal from isBlockEntryGuardedByCond called from
isKnownPredicateAt, but it's less powerful because it does not give context
to isImpliedCond. This patch reuses the isKnownPredicateAt function there,
reducing the amount of code duplication and making it more powerful.

Diff Detail

Event Timeline

mkazantsev created this revision.Nov 25 2020, 10:01 PM
Herald added a project: Restricted Project. · View Herald TranscriptNov 25 2020, 10:01 PM
mkazantsev requested review of this revision.Nov 25 2020, 10:01 PM
mkazantsev edited the summary of this revision. (Show Details)
skatkov accepted this revision.Nov 25 2020, 10:02 PM
This revision is now accepted and ready to land.Nov 25 2020, 10:02 PM

Strange. I'll revert it for now and investigate.

Maybe it's because isKnownPredicateAt makes an extra call to isKnownPredicate which we don't really need. Let's try more lightweight version with isBasicBlockEntryGuardedByCond. This should not introduce extra overhead.

Previous version was better, but still not good enough. Tried another version that removes two instances of isKnownViaNonRecuriveReasoning from the path.