This is an archive of the discontinued LLVM Phabricator instance.

[LICM] Report failing to hoist conditionally-executed loads
ClosedPublic

Authored by anemet on Dec 19 2016, 1:37 PM.

Details

Summary

These are interesting again because the user may not be aware that this
is a common reason preventing LICM.

A const is removed from an instruction pointer declaration in order to
pass it to ORE.

Event Timeline

anemet updated this revision to Diff 81994.Dec 19 2016, 1:37 PM
anemet retitled this revision from to [LICM] Report failing to hoist conditionally-executed loads.
anemet updated this object.
anemet added a reviewer: hfinkel.
anemet added a subscriber: llvm-commits.
anemet updated this revision to Diff 83102.Jan 4 2017, 11:54 AM

Rebase on top of the changes requested in D27938

hfinkel edited edge metadata.Jan 8 2017, 12:58 PM

This is a great idea! Users are very often unaware of this complication.

lib/Transforms/Scalar/LICM.cpp
797

I have the same question here as I did in D27939, is the CurLoop->isLoopInvariant check needed here? At least in the call on line 407, the call is guarded by CurLoop->hasLoopInvariantOperands.

anemet added inline comments.Jan 10 2017, 2:38 PM
lib/Transforms/Scalar/LICM.cpp
797

Similarly to D27939, I think, here too we need the check.

When isSafeToExecuteUnconditionally is called from canSinkOrHoistInst and we're sinking then the address is not necessarily loop-invariant.

hfinkel accepted this revision.Jan 10 2017, 4:53 PM
hfinkel edited edge metadata.

LGTM

This revision is now accepted and ready to land.Jan 10 2017, 4:53 PM
This revision was automatically updated to reflect the committed changes.