diff options
author | Devang Patel <dpatel@apple.com> | 2008-07-03 07:04:22 +0000 |
---|---|---|
committer | Devang Patel <dpatel@apple.com> | 2008-07-03 07:04:22 +0000 |
commit | 98260a474c7a6252611f8e6536b7d40e41f43621 (patch) | |
tree | a1270ce4cef3ed4fac1decef276eead62a409d24 /lib/Transforms/Scalar/LoopUnroll.cpp | |
parent | 70c09c54b1b5dcb8b757acae69261e4d45fbf4c3 (diff) | |
download | external_llvm-98260a474c7a6252611f8e6536b7d40e41f43621.zip external_llvm-98260a474c7a6252611f8e6536b7d40e41f43621.tar.gz external_llvm-98260a474c7a6252611f8e6536b7d40e41f43621.tar.bz2 |
Preserve dom info.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53089 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar/LoopUnroll.cpp')
-rw-r--r-- | lib/Transforms/Scalar/LoopUnroll.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/Transforms/Scalar/LoopUnroll.cpp b/lib/Transforms/Scalar/LoopUnroll.cpp index 1104c18..492db4d 100644 --- a/lib/Transforms/Scalar/LoopUnroll.cpp +++ b/lib/Transforms/Scalar/LoopUnroll.cpp @@ -55,6 +55,12 @@ namespace { AU.addRequired<LoopInfo>(); AU.addPreservedID(LCSSAID); AU.addPreserved<LoopInfo>(); + // FIXME: Loop unroll requires LCSSA. And LCSSA requires dom info. + // If loop unroll does not preserve dom info then LCSSA pass on next + // loop will receive invalid dom info. + // For now, recreate dom info, if loop is unrolled. + AU.addPreserved<DominatorTree>(); + AU.addPreserved<DominanceFrontier>(); } }; } @@ -137,8 +143,17 @@ bool LoopUnroll::runOnLoop(Loop *L, LPPassManager &LPM) { } // Unroll the loop. + Function *F = L->getHeader()->getParent(); if (!UnrollLoop(L, Count, LI, &LPM)) return false; + // FIXME: Reconstruct dom info, because it is not preserved properly. + DominatorTree *DT = getAnalysisToUpdate<DominatorTree>(); + if (DT) { + DT->runOnFunction(*F); + DominanceFrontier *DF = getAnalysisToUpdate<DominanceFrontier>(); + if (DF) + DF->runOnFunction(*F); + } return true; } |