Related to https://reviews.llvm.org/D80916
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
I don't particularly like all the code duplication. Is there a better way to arrange processLoopStoreOfLoopLoad?
llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp | ||
---|---|---|
1130–1131 | This is actually dead code, I've dropped it in bff94a8e2bb93267a561ca96287f570af499b090. |
I'd prefer to conservatively return true, rather than worry about whether calling expandCodeFor and cleaning it up is actually a pure no-op in terms of use-lists etc.
I'm curious about the motivation behind that statement. Existing code already tries to tidy up the code (e.g. line 1084), so I feel I'm just syndicating that code in one place.
Existing code already tries to tidy up the code (e.g. line 1084), so I feel I'm just syndicating that code in one place.
I'm not against trying to clean up the code; I'm just against asserting that we successfully managed to clean up the memory representation to exactly the same form it was in before we called expandCodeFor.
I'm not against trying to clean up the code; I'm just against asserting that we successfully managed to clean up the memory representation to exactly the same form it was in before we called expandCodeFor.
https://reviews.llvm.org/D80707 should guarentee that this assertion actually holds, right?
I don't trust that analysis passes verifying themselves will catch all the issues. At best, that only proves that we didn't invalidate any analysis that happened to be live at the time LoopIdiomRecognize runs.
@efriedma I believe @serge-sans-paille had D80916 in mind here, which provides a stronger guarantee, or at least has the potential to provide it. Of course, just returning true would be more conservative, and make little difference in practice.
llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp | ||
---|---|---|
1030 | Rather than explicitly calling clean() in all early-return paths, maybe do this in ~ExpandedValueCleaner() automatically, and add a commit() method or so for the single success path, that clears the vector? |
llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp | ||
---|---|---|
1066 | How does this work? I thought brace initialization was only for structs with public fields (but I'm clearly not an expert). And even if it does work, wouldn't parentheses be a bit more "normal" than braces? |
Final comments addressed in the actual commit.
llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp | ||
---|---|---|
1066 | That's a list-initialization falling back to constructor call, as described in https://en.cppreference.com/w/cpp/language/list_initialization grep for
I've updated the code to use classic constructor, it's less ambiguous for the reader :-) |
New line here seems unusual?