This is an archive of the discontinued LLVM Phabricator instance.

[EarlyIfCvt] Don't if-convert if condition has only loop-invariant ops.
ClosedPublic

Authored by fhahn on Jan 12 2023, 3:10 PM.

Details

Summary

This patch adds a heuristic to skip if-conversion if the condition has a
high chance of being predictable.

If the condition is in a loop, consider it predictable if the condition
itself or all its operands are loop-invariant. E.g. this considers a load
from a loop-invariant address predictable; we were unable to prove that it
doesn't alias any of the memory-writes in the loop, but it is likely to
read to same value multiple times.

This is a relatively crude heuristic, but it helps to prevent excessive
if-conversion in multiple workloads in practice.

Diff Detail

Event Timeline

fhahn created this revision.Jan 12 2023, 3:10 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 12 2023, 3:10 PM
fhahn requested review of this revision.Jan 12 2023, 3:10 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 12 2023, 3:10 PM
fhahn updated this revision to Diff 519044.May 3 2023, 5:49 AM

rebase and ping :)

apostolakis accepted this revision.May 3 2023, 8:00 AM

This looks reasonable to me.

This revision is now accepted and ready to land.May 3 2023, 8:00 AM
This revision was landed with ongoing or failed builds.May 12 2023, 11:21 AM
This revision was automatically updated to reflect the committed changes.

Thanks, PPC tests should be updated!

Matt added a subscriber: Matt.Sep 1 2023, 4:35 PM