forked from OSchip/llvm-project
Allow hoisting loads of globals and alloca's in conditionals.
llvm-svn: 18363
This commit is contained in:
parent
0ea40c935f
commit
6e455608e2
|
@ -592,6 +592,12 @@ bool LICM::isSafeToExecuteUnconditionally(Instruction &Inst) {
|
|||
if (Inst.getParent() == CurLoop->getHeader())
|
||||
return true;
|
||||
|
||||
// It's always safe to load from a global or alloca.
|
||||
if (isa<LoadInst>(Inst))
|
||||
if (isa<AllocationInst>(Inst.getOperand(0)) ||
|
||||
isa<GlobalVariable>(Inst.getOperand(0)))
|
||||
return true;
|
||||
|
||||
// Get the exit blocks for the current loop.
|
||||
std::vector<BasicBlock*> ExitBlocks;
|
||||
CurLoop->getExitBlocks(ExitBlocks);
|
||||
|
|
Loading…
Reference in New Issue