mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-13 20:32:21 +00:00
Allow hoisting loads of globals and alloca's in conditionals.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18363 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
478b3b42e2
commit
8a9193927a
@ -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
Block a user