diff options
author | Dan Gohman <gohman@apple.com> | 2012-01-04 23:01:09 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2012-01-04 23:01:09 +0000 |
commit | 7ac046a2616d71a8a6c2c618fb3b2bcff92c3a7d (patch) | |
tree | dbfdea237115c408b43c420ea092455cb3c03770 /llvm/lib/Analysis/ValueTracking.cpp | |
parent | 96c09687bce5e2dfb6f81eca705515a106d1c1a3 (diff) | |
download | llvm-7ac046a2616d71a8a6c2c618fb3b2bcff92c3a7d.zip llvm-7ac046a2616d71a8a6c2c618fb3b2bcff92c3a7d.tar.gz llvm-7ac046a2616d71a8a6c2c618fb3b2bcff92c3a7d.tar.bz2 |
Generalize isSafeToSpeculativelyExecute to work on arbitrary
Values, rather than just Instructions, since it's interesting
for ConstantExprs too.
llvm-svn: 147560
Diffstat (limited to 'llvm/lib/Analysis/ValueTracking.cpp')
-rw-r--r-- | llvm/lib/Analysis/ValueTracking.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp index 6de4426..6cef42d 100644 --- a/llvm/lib/Analysis/ValueTracking.cpp +++ b/llvm/lib/Analysis/ValueTracking.cpp @@ -1879,8 +1879,12 @@ bool llvm::onlyUsedByLifetimeMarkers(const Value *V) { return true; } -bool llvm::isSafeToSpeculativelyExecute(const Instruction *Inst, +bool llvm::isSafeToSpeculativelyExecute(const Value *V, const TargetData *TD) { + const Operator *Inst = dyn_cast<Operator>(V); + if (!Inst) + return false; + for (unsigned i = 0, e = Inst->getNumOperands(); i != e; ++i) if (Constant *C = dyn_cast<Constant>(Inst->getOperand(i))) if (C->canTrap()) |