This is an archive of the discontinued LLVM Phabricator instance.

[LV] Support invariant addresses in speculation logic
ClosedPublic

Authored by reames on Sep 9 2019, 2:16 PM.

Details

Summary

Implement a TODO from rL371452, and handle loop invariant addresses in predicated blocks. If we can prove that the load is safe to speculate into the header, then we can avoid using a masked.load in favour of a normal load.

This is mostly about vectorization robustness. In the common case, it's expected that LICM/LoadStorePromotion would have eliminated such loads entirely.

Diff Detail

Repository
rL LLVM

Event Timeline

reames created this revision.Sep 9 2019, 2:16 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 9 2019, 2:16 PM
reames updated this revision to Diff 219608.Sep 10 2019, 2:38 PM

Rebase after moving code to Loads.cpp

Ayal accepted this revision.Sep 11 2019, 12:44 PM
Ayal added a subscriber: anna.

Thanks, just a minor nit.

Note that LICM'ing a uniform load may require introducing a 1st-order recurrence phi due to a subsequent store to same uniform address, as noted e.g. in the last test added by @anna in D54538.

lib/Analysis/Loads.cpp
226 ↗(On Diff #219608)

nit: simply check if (EltSize != Step->getAPInt())? Admittedly relevant to previous patch, but seems more evident now.

This revision is now accepted and ready to land.Sep 11 2019, 12:44 PM
This revision was automatically updated to reflect the committed changes.