change assumption cache to store an assume along with an index to the operand bundle containing the knowledge.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
How does this work with multiple occurrences of a value in an assume?
change assumption cache to store an assume along with an index to the operand bundle containg the knoledge.
Two typos in the commit message
llvm/lib/Analysis/AssumptionCache.cpp | ||
---|---|---|
86 | Clang format the above please. | |
llvm/lib/Transforms/Utils/InlineFunction.cpp | ||
1846 | Can you make this a variable, hard to read and interpret this way. |
One more conceptual question and small nits.
llvm/lib/Analysis/AssumptionCache.cpp | ||
---|---|---|
60 | I usually prefer a struct instead of a pair but this is local only so I guess it's ok. Feel free to use the ResultElem or something similar to improve readability here and at the use site below. (AV.first will then become something meaningful on first glance.) | |
171 | Could you explain the need for the above logic please? Is is strictly related to the index extension or a general improvement? (Nit: Use a continue to reduce indention and simplify the code) |
llvm/lib/Analysis/AssumptionCache.cpp | ||
---|---|---|
171 | the AffectedValues map can associate multiple assumes with a single value this is true before and after the patch although i am not sure it is reachable before the patch. here is an example of when this change matters: call void @llvm.assume(i1 true) ["nonnull"(i32* %P)] ; called A call void @llvm.assume(i1 true) ["align"(i32* %P, i32 4)] ; called B with both A and B in cache both A and B will be in the AffectedValues for %P. without this change if unregisterAssumption is called on A, all assumption of P will be invalidate even the one in B, however B will still be in the AssumeHandles (the list of all assumes in the function). this is not strictly related only to AssumeBundles. but it makes a difference in a situtation which is rare if possible without assume bundles. Note: that having a nullptr in assumption is already possible since Value* are stored in WeakTrackingVH so it can be set to null if it is removed. |
LGTM, see below for some additional style changes and documentation you should apply before committing.
llvm/lib/Analysis/AssumptionCache.cpp | ||
---|---|---|
171 | OK. I expected this to be a improvement not strictly related to assume bundles but I wasn't sure. You explanation makes sense to me. Before you commit maybe replace AVI != ..end() with the opposite condition and a continue. |
I usually prefer a struct instead of a pair but this is local only so I guess it's ok. Feel free to use the ResultElem or something similar to improve readability here and at the use site below. (AV.first will then become something meaningful on first glance.)