[unroll] Strengthen verification of analysis updates under expensive asserts
I am suspecting a bug around updates of loop info for unreachable exits, but don't have a test case. Running this locally on make check didn't reveal anything, we'll see if the expensive checks bots find it.
This commit is contained in:
parent
ea66b46dde
commit
916b35e783
|
@ -99,6 +99,17 @@ UnrollVerifyDomtree("unroll-verify-domtree", cl::Hidden,
|
|||
#endif
|
||||
);
|
||||
|
||||
static cl::opt<bool>
|
||||
UnrollVerifyLoopInfo("unroll-verify-loopinfo", cl::Hidden,
|
||||
cl::desc("Verify loopinfo after unrolling"),
|
||||
#ifdef EXPENSIVE_CHECKS
|
||||
cl::init(true)
|
||||
#else
|
||||
cl::init(false)
|
||||
#endif
|
||||
);
|
||||
|
||||
|
||||
/// Check if unrolling created a situation where we need to insert phi nodes to
|
||||
/// preserve LCSSA form.
|
||||
/// \param Blocks is a vector of basic blocks representing unrolled loop.
|
||||
|
@ -764,6 +775,9 @@ LoopUnrollResult llvm::UnrollLoop(Loop *L, UnrollLoopOptions ULO, LoopInfo *LI,
|
|||
// Apply updates to the DomTree.
|
||||
DT = &DTU.getDomTree();
|
||||
|
||||
assert(!UnrollVerifyDomtree ||
|
||||
DT->verify(DominatorTree::VerificationLevel::Fast));
|
||||
|
||||
// At this point, the code is well formed. We now simplify the unrolled loop,
|
||||
// doing constant propagation and dead code elimination as we go.
|
||||
simplifyLoopAfterUnroll(L, !CompletelyUnroll && ULO.Count > 1, LI, SE, DT, AC,
|
||||
|
@ -777,6 +791,10 @@ LoopUnrollResult llvm::UnrollLoop(Loop *L, UnrollLoopOptions ULO, LoopInfo *LI,
|
|||
if (CompletelyUnroll)
|
||||
LI->erase(L);
|
||||
|
||||
// LoopInfo should not be valid, confirm that.
|
||||
if (UnrollVerifyLoopInfo)
|
||||
LI->verify(*DT);
|
||||
|
||||
// After complete unrolling most of the blocks should be contained in OuterL.
|
||||
// However, some of them might happen to be out of OuterL (e.g. if they
|
||||
// precede a loop exit). In this case we might need to insert PHI nodes in
|
||||
|
|
Loading…
Reference in New Issue