diff options
author | Tobias Grosser <grosser@fim.uni-passau.de> | 2010-07-16 05:59:45 +0000 |
---|---|---|
committer | Tobias Grosser <grosser@fim.uni-passau.de> | 2010-07-16 05:59:45 +0000 |
commit | 74c740052a143027bbc2d14594d6188e2e597fa1 (patch) | |
tree | f6aeb9bab22b70a139c6998196090592387a474e | |
parent | 9a7b37b8a35e60494cde8b2bb6b6cab587836c7a (diff) | |
download | external_llvm-74c740052a143027bbc2d14594d6188e2e597fa1.zip external_llvm-74c740052a143027bbc2d14594d6188e2e597fa1.tar.gz external_llvm-74c740052a143027bbc2d14594d6188e2e597fa1.tar.bz2 |
LoopSimplify does not update domfrontier correctly.
This fixes PR7649.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108513 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/VMCore/Dominators.cpp | 4 | ||||
-rw-r--r-- | test/Transforms/LoopSimplify/2010-07-15-IncorrectDomFrontierUpdate.ll | 20 |
2 files changed, 22 insertions, 2 deletions
diff --git a/lib/VMCore/Dominators.cpp b/lib/VMCore/Dominators.cpp index ef83033..58ce05c 100644 --- a/lib/VMCore/Dominators.cpp +++ b/lib/VMCore/Dominators.cpp @@ -148,11 +148,11 @@ void DominanceFrontier::splitBlock(BasicBlock *NewBB) { } // If NewBB dominates NewBBSucc, then DF(NewBB) is now going to be the - // DF(PredBlocks[0]) without the stuff that the new block does not dominate + // DF(NewBBSucc) without the stuff that the new block does not dominate // a predecessor of. DominatorTree &DT = getAnalysis<DominatorTree>(); if (DT.dominates(NewBB, NewBBSucc)) { - DominanceFrontier::iterator DFI = find(PredBlocks[0]); + DominanceFrontier::iterator DFI = find(NewBBSucc); if (DFI != end()) { DominanceFrontier::DomSetType Set = DFI->second; // Filter out stuff in Set that we do not dominate a predecessor of. diff --git a/test/Transforms/LoopSimplify/2010-07-15-IncorrectDomFrontierUpdate.ll b/test/Transforms/LoopSimplify/2010-07-15-IncorrectDomFrontierUpdate.ll new file mode 100644 index 0000000..2a1ee7d --- /dev/null +++ b/test/Transforms/LoopSimplify/2010-07-15-IncorrectDomFrontierUpdate.ll @@ -0,0 +1,20 @@ +; RUN: opt < %s -domfrontier -loopsimplify -domfrontier -verify-dom-info -analyze + + +define void @a() nounwind { +entry: + br i1 undef, label %bb37, label %bb1.i + +bb1.i: ; preds = %bb1.i, %bb + %indvar = phi i64 [ %indvar.next, %bb1.i ], [ 0, %entry ] ; <i64> [#uses=1] + %indvar.next = add i64 %indvar, 1 ; <i64> [#uses=2] + %exitcond = icmp eq i64 %indvar.next, 576 ; <i1> [#uses=1] + br i1 %exitcond, label %bb37, label %bb1.i + +bb37: ; preds = %bb1.i, %bb + br label %return + + +return: ; preds = %bb39 + ret void +} |