This patch adds the basic utilities to deal with dropable uses. dropable uses are uses that we rather drop than prevent transformations, for now they are limited to uses in llvm.assume.
Details
Diff Detail
Event Timeline
We need to split this patch. The droppable logic can be applied to regular assumes already so we can separate this from the operand bundle stuff at first. That should make the patches significantly smaller. You also need to separate D73404 out.
llvm/lib/IR/Value.cpp | ||
---|---|---|
181 | We have to make sure we handle "incomplete" operand bundles properly. I guess if we always go through KnowledgeRetention we can make sure of that. |
I'm not sure i'm fully onboard with using generic 'droppable' term for these uses.
Can we be somehow more specific, since those are really only ever about assumes?
llvm/include/llvm/ADT/STLExtras.h | ||
---|---|---|
1534 | These changes can be separated into another review |
i don't know if it can be useful in other situations than for uses in assume.
if you think it probably won't we can just call then use in assume.
There might be other operand bundle and metadata uses we want to drop later. Unclear. We could also rename it to "drop assume uses"
I think this makes sense, especially since lifetime markers will soon join assume as droppable users. That said, we need to improve the nullptr replacement for assume. I made some suggestions here https://reviews.llvm.org/D73832#1902199
llvm/include/llvm/IR/User.h | ||
---|---|---|
224 | We should list what those uses are, later maybe define an enum to restrict the selection. |
Changes:
- Dropped uses in assume are represented the tag ignore and the values are replaced with undef.
- this broke the ordering invariance that hasAttributeInAssume was depending upon so i changed the implementation to a more naive linear search.
- changed the test in KnowledgeRetentionTest.cpp to make them easier to write.
- adapted the LangRef and verifier to the new "ignore" tag.
an assume containg a dropped use now looks like
call void @llvm.assume(i1 true) [ "ignore"(i32* undef, i64 8) ]
Yes, i suppose given that we now have a second user (lifetime), droppable isn't the worst choice.
llvm/lib/IR/KnowledgeRetention.cpp | ||
---|---|---|
220 ↗ | (On Diff #248999) | Can we give it a more descriptive name than Loop. |
These changes can be separated into another review