This patch makes GetUnderlyingObject/Objects use MemorySSA if it is given.
Any comment is welcome. :)
Paths
| Differential D50295
Let GetUnderlyingObject/Objects use MemorySSA AbandonedPublic Authored by aqjune on Aug 4 2018, 2:22 AM.
Details
Summary This patch makes GetUnderlyingObject/Objects use MemorySSA if it is given. Any comment is welcome. :)
Diff Detail Event TimelineHerald added subscribers: llvm-commits, george.burgess.iv, Prazek. · View Herald TranscriptAug 4 2018, 2:22 AM Comment Actions Seems like an interesting idea. What's the motivation for doing this? I'm uneasy with making GetUnderlyingObject fundamentally more powerful than GetUnderlyingObjects - the latter should always provide a superset of the functionality of the former.
Comment Actions Thanks for this! In addition to Hal's comments...
aqjune retitled this revision from Let GetUnderlyingObject use MemorySSA to Let GetUnderlyingObject/Objects use MemorySSA. Comment Actions
Comment Actions Thanks for the comments! @hfinkel The motivation is that GetUnderlyingObject stucks at cases like this: store i8* %p, i8** %q %p2 = load i8*, i8** %q ; p2 is p If we have MemorySSA, this can be resolved in constant time. I believe BasicAliasAnalysis can get benefit this, hence supporting partially flow sensitive analysis. Regarding GetUnderlyingObjects - this patch contains update to help GetUnderlyingObjects use MemorySSA as well, by passing the argument into GetUnderlyingObject. I found that description/title of this patch wasn't containing the info. so I updated it. Comment Actions
I read that in the comment ;) -- but why? Shouldn't all such cases be simplified by GVN (etc.) into a form where GetUnderlyingObjects, as is, can reason about them?
Comment Actions
Ideally, yes - but wouldn't eagerly removing such store-load pairs be costly?
Revision Contents
Diff 159196 include/llvm/Analysis/ValueTracking.h
lib/Analysis/ValueTracking.cpp
unittests/Analysis/ValueTrackingTest.cpp
|
This isn't always true: MSSA models volatile/atomic (>= monotonic) loads as MemoryDefs. Do we check for this elsewhere in this function?
If so, all of this can be collapsed into auto *MLoad = cast<MemoryUse>(MSSA->getMemoryAccess(LI));. If not, please make it a dyn_cast<MemoryUse>(MSSA->getMemoryAccess(LI)) + null check.