This is part of the series started by D9375, and lets GetUnderlyingObjects, optionally, collect the llvm.noalias calls that it has looked through. This will be used by the AA implementation for llvm.noalias, to avoid double-walking (which could be expensive) and copy-and-paste.
Diff Detail
Event Timeline
Resigning as a reviewer to get a very stale review off my list of blocking tasks in phabricator. Please reopen when desired.
Rebased.
I've thought about how to generalize this (it seems kind of silly to have GetUnderlyingObject(s) have a special parameter for this), but because I don't think that imposing the overhead of a virtual function call for each visited instruction is reasonable, I think the way to generalize it is to template it on some kind of customization functor. I've done that here, in the name of keeping this change small, and because I don't yet have a second use case. I'm happy to do the generalization either sequenced before this change or afterward (assuming, of course, we don't decide on a completely different way to satisfy this use case).
include/llvm/Analysis/ValueTracking.h | ||
---|---|---|
227–235 | Perhaps the NoAlias parameter deserves a mention? | |
lib/Analysis/ValueTracking.cpp | ||
3070 | auto *I | |
3070 | Should we assign V the value of I->getOperand(0) ? | |
3070–3071 | The following might be a little shorter: if (match(V, m_Intrinsic<Intrinsic::noalias>()) | |
3071 | Braces are unneeded. |
LGTM with nits
include/llvm/Analysis/ValueTracking.h | ||
---|---|---|
228–235 | I find it more likely that a SmallVector will get passed in instead of a custom MaxLookup. Perhaps they should be reordered to one another? |
lib/Analysis/ValueTracking.cpp | ||
---|---|---|
3070–3074 | I think you can sink this into the block for the auto CS = CallSite(V) condition. You can compare CS.getIntrinsicID() with Intrinsic::noalias. |
lib/Analysis/ValueTracking.cpp | ||
---|---|---|
3070–3074 | Yes, indeed! |
Perhaps the NoAlias parameter deserves a mention?