From 6b50bc9d88538c155503582b095fdba518070257 Mon Sep 17 00:00:00 2001 From: Devang Patel Date: Mon, 10 Oct 2011 20:32:03 +0000 Subject: If loop header is also loop exiting block then it may not be safe to hoist instructions. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141576 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/MachineLICM.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'lib/CodeGen') diff --git a/lib/CodeGen/MachineLICM.cpp b/lib/CodeGen/MachineLICM.cpp index f8cbe41b94..bd25b2c6b6 100644 --- a/lib/CodeGen/MachineLICM.cpp +++ b/lib/CodeGen/MachineLICM.cpp @@ -1145,13 +1145,12 @@ bool MachineLICM::IsGuaranteedToExecute(MachineInstr *MI) { return true; // Get the exit blocks for the current loop. - SmallVector ExitBlocks; - CurLoop->getExitingBlocks(ExitBlocks); + SmallVector ExitingBlocks; + CurLoop->getExitingBlocks(ExitingBlocks); // Verify that the block dominates each of the exit blocks of the loop. - for (unsigned i = 0, e = ExitBlocks.size(); i != e; ++i) - if (ExitBlocks[i] != CurLoop->getHeader() && - !DT->dominates(MI->getParent(), ExitBlocks[i])) + for (unsigned i = 0, e = ExitingBlocks.size(); i != e; ++i) + if (!DT->dominates(MI->getParent(), ExitingBlocks[i])) return false; return true; -- cgit v1.2.3