diff options
| author | Eric Christopher <echristo@apple.com> | 2009-12-10 00:25:41 +0000 |
|---|---|---|
| committer | Eric Christopher <echristo@apple.com> | 2009-12-10 00:25:41 +0000 |
| commit | 22889c049d02aa25ae37c1030c21d9ce8035af4b (patch) | |
| tree | 4f2bc71b84a15a22aaa3eea6d8f24d582ce89d62 /llvm/lib | |
| parent | 8a9a97a660f7792aed12aceaddf447c260e17ddd (diff) | |
| download | bcm5719-llvm-22889c049d02aa25ae37c1030c21d9ce8035af4b.tar.gz bcm5719-llvm-22889c049d02aa25ae37c1030c21d9ce8035af4b.zip | |
Make sure the immediate dominator isn't NULL through iterations
of the loop. We could get to this condition via indirect
branches.
llvm-svn: 91009
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/LICM.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/llvm/lib/Transforms/Scalar/LICM.cpp b/llvm/lib/Transforms/Scalar/LICM.cpp index 5511387c8da..42a8fdc6aa8 100644 --- a/llvm/lib/Transforms/Scalar/LICM.cpp +++ b/llvm/lib/Transforms/Scalar/LICM.cpp @@ -160,16 +160,17 @@ namespace { // Because the exit block is not in the loop, we know we have to get _at // least_ its immediate dominator. - do { - // Get next Immediate Dominator. - IDom = IDom->getIDom(); - + IDom = IDom->getIDom(); + + while (IDom && IDom != BlockInLoopNode) { // If we have got to the header of the loop, then the instructions block // did not dominate the exit node, so we can't hoist it. if (IDom->getBlock() == LoopHeader) return false; - } while (IDom != BlockInLoopNode); + // Get next Immediate Dominator. + IDom = IDom->getIDom(); + }; return true; } |

