mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-25 13:24:46 +00:00
Replace isTrapping with a new, similar method called
isSafeToSpeculativelyExecute. The new method is a bit closer to what the callers actually care about in that it rejects more things callers don't want. It also adds more precise handling for integer division, and unifies code for analyzing the legality of a speculative load. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76150 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -623,7 +623,8 @@ void LICM::hoist(Instruction &I) {
|
||||
///
|
||||
bool LICM::isSafeToExecuteUnconditionally(Instruction &Inst) {
|
||||
// If it is not a trapping instruction, it is always safe to hoist.
|
||||
if (!Inst.isTrapping()) return true;
|
||||
if (Inst.isSafeToSpeculativelyExecute())
|
||||
return true;
|
||||
|
||||
// Otherwise we have to check to make sure that the instruction dominates all
|
||||
// of the exit blocks. If it doesn't, then there is a path out of the loop
|
||||
@@ -635,12 +636,6 @@ 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.
|
||||
SmallVector<BasicBlock*, 8> ExitBlocks;
|
||||
CurLoop->getExitBlocks(ExitBlocks);
|
||||
|
Reference in New Issue
Block a user