For a given loop, getLoopLatch returns a non-null value
when a loop has only one latch block. In the modified
context adding an assertion to check that both the outgoing branches of
a terminator instruction (of latch) does not target same header.
+
few minor code reorganization.
Details
- Reviewers
jbhateja - Commits
- rG7410eead0c4b: [SCEV] Adding a check on outgoing branches of a terminator instr for…
rGa1da5e4ce743: [SCEV] NFC : Removing unnecessary check on outgoing branches of a branch instr.
rL318997: [SCEV] Adding a check on outgoing branches of a terminator instr for…
rL318991: [SCEV] NFC : Removing unnecessary check on outgoing branches of a branch instr.
Diff Detail
- Repository
- rL LLVM
Event Timeline
llvm/trunk/lib/Analysis/ScalarEvolution.cpp | ||
---|---|---|
4095 | Can you please add an assert here that BI->getSuccessor(0) != BI->getSuccessor(1)? That way we'll know to update this place if/when getLoopLatch() becomes smarter. |
llvm/trunk/lib/Analysis/ScalarEvolution.cpp | ||
---|---|---|
4095 | I guess we will have to look at all the places from where a call to getLoopLatch is made, adding such an assert at one place does not looks reasonable. |
llvm/trunk/lib/Analysis/ScalarEvolution.cpp | ||
---|---|---|
4095 |
I'm not sure I agree. Here we rely on BI->getSuccessor(0) != BI->getSuccessor(1) implied from getLoopLatch() for correctness, and asserting that precondition seems like an incremental improvement, irrespective of what we do for the other places. Secondly, I don't think asserting BI->getSuccessor(0) != BI->getSuccessor(1) everywhere we call getLoopLatch() is a good idea anyway. We should assert BI->getSuccessor(0) != BI->getSuccessor(1) where it matters to the code that called getLoopLatch(), not to all places that call getLoopLatch(). |
Can you please add an assert here that BI->getSuccessor(0) != BI->getSuccessor(1)? That way we'll know to update this place if/when getLoopLatch() becomes smarter.