mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2026-04-25 21:18:19 +00:00
Move Instruction::isSafeToSpeculativelyExecute out of VMCore and
into Analysis as a standalone function, since there's no need for it to be in VMCore. Also, update it to use isKnownNonZero and other goodies available in Analysis, making it more precise, enabling more aggressive optimization. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@146610 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "llvm/Analysis/PHITransAddr.h"
|
||||
#include "llvm/Analysis/ValueTracking.h"
|
||||
#include "llvm/Constants.h"
|
||||
#include "llvm/Instructions.h"
|
||||
#include "llvm/Analysis/Dominators.h"
|
||||
@@ -27,7 +28,7 @@ static bool CanPHITrans(Instruction *Inst) {
|
||||
return true;
|
||||
|
||||
if (isa<CastInst>(Inst) &&
|
||||
Inst->isSafeToSpeculativelyExecute())
|
||||
isSafeToSpeculativelyExecute(Inst))
|
||||
return true;
|
||||
|
||||
if (Inst->getOpcode() == Instruction::Add &&
|
||||
@@ -186,7 +187,7 @@ Value *PHITransAddr::PHITranslateSubExpr(Value *V, BasicBlock *CurBB,
|
||||
// operands need to be phi translated, and if so, reconstruct it.
|
||||
|
||||
if (CastInst *Cast = dyn_cast<CastInst>(Inst)) {
|
||||
if (!Cast->isSafeToSpeculativelyExecute()) return 0;
|
||||
if (!isSafeToSpeculativelyExecute(Cast)) return 0;
|
||||
Value *PHIIn = PHITranslateSubExpr(Cast->getOperand(0), CurBB, PredBB, DT);
|
||||
if (PHIIn == 0) return 0;
|
||||
if (PHIIn == Cast->getOperand(0))
|
||||
@@ -381,7 +382,7 @@ InsertPHITranslatedSubExpr(Value *InVal, BasicBlock *CurBB,
|
||||
|
||||
// Handle cast of PHI translatable value.
|
||||
if (CastInst *Cast = dyn_cast<CastInst>(Inst)) {
|
||||
if (!Cast->isSafeToSpeculativelyExecute()) return 0;
|
||||
if (!isSafeToSpeculativelyExecute(Cast)) return 0;
|
||||
Value *OpVal = InsertPHITranslatedSubExpr(Cast->getOperand(0),
|
||||
CurBB, PredBB, DT, NewInsts);
|
||||
if (OpVal == 0) return 0;
|
||||
|
||||
Reference in New Issue
Block a user