This is an archive of the discontinued LLVM Phabricator instance.

[LICM] Bail if checking a global/constant for invariant.start
ClosedPublic

Authored by aeubanks on Oct 4 2021, 1:48 PM.

Details

Summary

When we check if a load is loop invariant by finding a dominating
invariant.start call, we strip bitcasts until we get to an i8* Value,
and look for an invariant.start use of the i8* Value.

We may accidentally end up at an i8 global and look at a global's uses,
which we shouldn't do in a loop pass. Although we could make this
logic work with globals, that's not currently intended.

Diff Detail

Event Timeline

aeubanks created this revision.Oct 4 2021, 1:48 PM
aeubanks requested review of this revision.Oct 4 2021, 1:48 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 4 2021, 1:48 PM
aeubanks updated this revision to Diff 377028.Oct 4 2021, 1:49 PM

remove FIXME

nikic accepted this revision.Oct 4 2021, 1:54 PM

LGTM, this matches what we do elsewhere.

llvm/test/Transforms/LICM/hoisting.ll
605

This makes it sound like there's a correctness (or at least profitability) reason not to hoist these, while ultimately this is only a technical limitation (right?) I'd make this "Hoisting invariant loads of globals is currently not supported" or invert the fixme to "FIXME: Support hoisting invariant loads of globals".

This revision is now accepted and ready to land.Oct 4 2021, 1:54 PM
aeubanks updated this revision to Diff 377030.Oct 4 2021, 2:00 PM

update test comment

This revision was landed with ongoing or failed builds.Oct 4 2021, 2:14 PM
This revision was automatically updated to reflect the committed changes.