This is an archive of the discontinued LLVM Phabricator instance.

HotColdSplitting: invalidate the AssumptionCache on split
ClosedPublic

Authored by compnerd on Sep 23 2019, 2:42 PM.

Details

Reviewers
hiraditya
Summary

When a cold path is outlined, the value tracking in the assumption cache may be
invalidated due to the code motion. We would previously trip an assertion in
subsequent passes (but required the passes to happen in a single run as the
assumption cache is shared across the passes). Invalidating the cache ensures
that we get the correct information when needed with the legacy pass manager as
well.

Diff Detail

Repository
rL LLVM

Event Timeline

compnerd created this revision.Sep 23 2019, 2:42 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 23 2019, 2:42 PM
hiraditya accepted this revision.Sep 23 2019, 2:45 PM

LGTM, thanks for spotting+fixing this bug.

This revision is now accepted and ready to land.Sep 23 2019, 2:45 PM
hiraditya added inline comments.Sep 23 2019, 2:47 PM
lib/Transforms/IPO/HotColdSplitting.cpp
665

LookupAC(F) may return a nullptr, so we might have to take care of that.

It's weird though. Nothing else calls AssumptionCache::clear().
*Why* it is being preserved? It seems there might be a bigger bug.

Assumptions shouldn't change by optimization, code movement etc AFAICT. As Assumption cache doesn't currently have APIs to accomodate the changes caused by function splitting, invalidating the cache seems reasonable to me. If another pass requests for assumptions, they will be re-scanned, include/llvm/Analysis/AssumptionCache.h:132

compnerd closed this revision.Sep 23 2019, 3:21 PM

r372667