This is an archive of the discontinued LLVM Phabricator instance.

[LAA] We only need pointer checks if there are non-zero checks (NFC).
ClosedPublic

Authored by fhahn on May 14 2020, 2:51 PM.

Details

Summary

If it turns out that we can do runtime checks, but there are no
runtime-checks to generate, set RtCheck.Need to false.

This can happen if we can prove statically that the pointers passed in
to canCheckPtrAtRT do not alias. This should not change any results, but
allows us to skip some work and assert that runtime checks are
generated, if LAA indicates that runtime checks are required.

Diff Detail

Event Timeline

fhahn created this revision.May 14 2020, 2:51 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 14 2020, 2:51 PM
Herald added a subscriber: hiraditya. · View Herald Transcript
Ayal accepted this revision.May 26 2020, 2:43 PM

Looks good to me. Added a minor nit.

llvm/lib/Analysis/LoopAccessAnalysis.cpp
821

Sounds a bit confusing to continue having both RtCheck.Need and NeedRTCheck, where the former no longer simply caches the value of the latter. Could one be more accurately renamed?

This revision is now accepted and ready to land.May 26 2020, 2:43 PM
fhahn marked an inline comment as done.May 27 2020, 4:48 AM
fhahn added inline comments.
llvm/lib/Analysis/LoopAccessAnalysis.cpp
821

I've considered removing NeedRTCheck and use RtCheck.Need directly, but there is at least one early exit, which would have RtCheck.Need not set, which may have additional implications.

So I went with renaming NeedRTCheck to MayNeedRTCheck in the committed version, which should more accurately reflect what it represents. Please let me know if you think that's sufficient. Otherwise I am happy to do another round of renaming.

This revision was automatically updated to reflect the committed changes.