diff options
author | Dan Gohman <gohman@apple.com> | 2011-12-14 23:49:11 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2011-12-14 23:49:11 +0000 |
commit | 75d7d5e988539819d596f345d99c26a7aa3bd09b (patch) | |
tree | 16a51fb02f09e88467601a2d6ae95565d0ecfb2b /llvm/lib/Analysis/PHITransAddr.cpp | |
parent | 9efd7ebf0a071d757d2c7d95920673e3433d9e7a (diff) | |
download | bcm5719-llvm-75d7d5e988539819d596f345d99c26a7aa3bd09b.tar.gz bcm5719-llvm-75d7d5e988539819d596f345d99c26a7aa3bd09b.zip |
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.
llvm-svn: 146610
Diffstat (limited to 'llvm/lib/Analysis/PHITransAddr.cpp')
-rw-r--r-- | llvm/lib/Analysis/PHITransAddr.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/llvm/lib/Analysis/PHITransAddr.cpp b/llvm/lib/Analysis/PHITransAddr.cpp index 86d915ff0ab..80ea219cd82 100644 --- a/llvm/lib/Analysis/PHITransAddr.cpp +++ b/llvm/lib/Analysis/PHITransAddr.cpp @@ -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; |