This patch adds a method to determine if a loop is in rotated form (the latch is
an exiting block). It also modifies the getLoopGuardBranch method to use this
new method. This method can also be used in Loopfusion. Once this patch lands I
will make the corresponding changes there.
Details
Details
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
llvm/include/llvm/Analysis/LoopInfo.h | ||
---|---|---|
763 | I think it would be simpler if the function would return false if there are multiple latches with the meaning that the loop is not in loop-rotated normal form. Note that there might still be multiple exiting edges, e.g. if the latch's terminator is a switch. I can also think a definition for rotated with multiple latches: All latches' outgoing edges that are not backedges are existing (so the property is orthogonal to simplified form), but this would probably not be useful for anything. | |
llvm/unittests/Analysis/LoopInfoTest.cpp | ||
1419 | [suggestion] EXPECT_FALSE(L->isRotated()) to have a negative test as well. |
Comment Actions
- Return false if no latch block exists, instead of assert (based on suggestion from Meinersbur)
- Add negative test case for loop that is not rotated.
I think it would be simpler if the function would return false if there are multiple latches with the meaning that the loop is not in loop-rotated normal form.
Note that there might still be multiple exiting edges, e.g. if the latch's terminator is a switch.
I can also think a definition for rotated with multiple latches: All latches' outgoing edges that are not backedges are existing (so the property is orthogonal to simplified form), but this would probably not be useful for anything.