LICM.cpp (200581) | LICM.cpp (201360) |
---|---|
1//===-- LICM.cpp - Loop Invariant Code Motion Pass ------------------------===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// --- 419 unchanged lines hidden (view full) --- 428 for (Value::use_iterator UI = I.use_begin(), E = I.use_end(); UI != E; ++UI) { 429 Instruction *User = cast<Instruction>(*UI); 430 if (PHINode *PN = dyn_cast<PHINode>(User)) { 431 // PHI node uses occur in predecessor blocks! 432 for (unsigned i = 0, e = PN->getNumIncomingValues(); i != e; ++i) 433 if (PN->getIncomingValue(i) == &I) 434 if (CurLoop->contains(PN->getIncomingBlock(i))) 435 return false; | 1//===-- LICM.cpp - Loop Invariant Code Motion Pass ------------------------===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// --- 419 unchanged lines hidden (view full) --- 428 for (Value::use_iterator UI = I.use_begin(), E = I.use_end(); UI != E; ++UI) { 429 Instruction *User = cast<Instruction>(*UI); 430 if (PHINode *PN = dyn_cast<PHINode>(User)) { 431 // PHI node uses occur in predecessor blocks! 432 for (unsigned i = 0, e = PN->getNumIncomingValues(); i != e; ++i) 433 if (PN->getIncomingValue(i) == &I) 434 if (CurLoop->contains(PN->getIncomingBlock(i))) 435 return false; |
436 } else if (CurLoop->contains(User->getParent())) { | 436 } else if (CurLoop->contains(User)) { |
437 return false; 438 } 439 } 440 return true; 441} 442 443 444/// isLoopInvariantInst - Return true if all operands of this instruction are --- 381 unchanged lines hidden (view full) --- 826 // It is safe to promote P if all uses are direct load/stores and if at 827 // least one is guaranteed to be executed. 828 bool GuaranteedToExecute = false; 829 bool InvalidInst = false; 830 for (Value::use_iterator UI = V->use_begin(), UE = V->use_end(); 831 UI != UE; ++UI) { 832 // Ignore instructions not in this loop. 833 Instruction *Use = dyn_cast<Instruction>(*UI); | 437 return false; 438 } 439 } 440 return true; 441} 442 443 444/// isLoopInvariantInst - Return true if all operands of this instruction are --- 381 unchanged lines hidden (view full) --- 826 // It is safe to promote P if all uses are direct load/stores and if at 827 // least one is guaranteed to be executed. 828 bool GuaranteedToExecute = false; 829 bool InvalidInst = false; 830 for (Value::use_iterator UI = V->use_begin(), UE = V->use_end(); 831 UI != UE; ++UI) { 832 // Ignore instructions not in this loop. 833 Instruction *Use = dyn_cast<Instruction>(*UI); |
834 if (!Use || !CurLoop->contains(Use->getParent())) | 834 if (!Use || !CurLoop->contains(Use)) |
835 continue; 836 837 if (!isa<LoadInst>(Use) && !isa<StoreInst>(Use)) { 838 InvalidInst = true; 839 break; 840 } 841 842 if (!GuaranteedToExecute) --- 41 unchanged lines hidden --- | 835 continue; 836 837 if (!isa<LoadInst>(Use) && !isa<StoreInst>(Use)) { 838 InvalidInst = true; 839 break; 840 } 841 842 if (!GuaranteedToExecute) --- 41 unchanged lines hidden --- |