isAvailableAtLoopEntry duplicates logic of properlyDominates after checking invariance.
This patch replaces this logic with invocation of this method which is more profitable
because it supports caching.
Details
Diff Detail
Event Timeline
lib/Analysis/ScalarEvolution.cpp | ||
---|---|---|
2237 | Looks like properlyDominates is not transitive when this used to be transitive? (It could be that properlyDominates is incorrect itself and needs to be transitive too - if yes, let's make that change first.) |
lib/Analysis/ScalarEvolution.cpp | ||
---|---|---|
2237 | I didn't get what do you mean under "transitive" in this context. The only significant difference I see is that getBlockDisposition is implemented via recursion with global caching and this is via SCEV traversal with local caching. Global caching is more profitable in this case since we can end up checking the same SCEVs again and again. I don't think there are any functional differences. |
lib/Analysis/ScalarEvolution.cpp | ||
---|---|---|
2237 | Yes, you're right, I missed the recursion in ScalarEvolution::computeBlockDisposition. Do you mind, as a later change, rewriting ScalarEvolution::computeBlockDisposition to use SCEVTraversal? That's more idiomatic and reduces (although only by a little bit :) ) the possibility of stack overflow. |
lib/Analysis/ScalarEvolution.cpp | ||
---|---|---|
2237 | I think we could do it, yes. But in this case we cache the same data in both local and global cache. I think we can replace it with a global traversal or something. :) |
Looks like properlyDominates is not transitive when this used to be transitive?
(It could be that properlyDominates is incorrect itself and needs to be transitive too - if yes, let's make that change first.)