This patch updates isGuaranteedNotToBeUndefOrPoison to use llvm.assume's noundef operand bundle.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
llvm/lib/Analysis/ValueTracking.cpp | ||
---|---|---|
4843 | I thought we had a helper for this, I think it is hasAttributeInAssume in llvm/include/llvm/Analysis/AssumeBundleQueries.h. If that is not enough we should extend it for sure. This kind of query is common and easy to get wrong. For example, this doesn't handle multiple noundef bundles. |
you probably want to add noundef to isUsefullToPreserve such that it gets preserved automatically when knowledge retention is turned on.
llvm/lib/Analysis/ValueTracking.cpp | ||
---|---|---|
4843 | there is getKnowledgeValidInContext which should be enough for what is being done here. it also has a fallback when there is no AssumptionCache. |
llvm/lib/Analysis/ValueTracking.cpp | ||
---|---|---|
4843 | Thanks for the infos! |
All of this makes sense to me. Testing coverage is low though.
llvm/lib/Transforms/Utils/AssumeBundleBuilder.cpp | ||
---|---|---|
63 | We should have a test for this I think. I imagine inlining a noundef attribute with knowledge retention enabled should actually cause an assume now. |
llvm/lib/Transforms/Utils/AssumeBundleBuilder.cpp | ||
---|---|---|
63 | It worked, thanks |
I thought we had a helper for this, I think it is hasAttributeInAssume in llvm/include/llvm/Analysis/AssumeBundleQueries.h. If that is not enough we should extend it for sure. This kind of query is common and easy to get wrong. For example, this doesn't handle multiple noundef bundles.