aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Analysis/ValueTracking.cpp
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2012-01-04 23:01:09 +0000
committerDan Gohman <gohman@apple.com>2012-01-04 23:01:09 +0000
commit7ac046a2616d71a8a6c2c618fb3b2bcff92c3a7d (patch)
treedbfdea237115c408b43c420ea092455cb3c03770 /llvm/lib/Analysis/ValueTracking.cpp
parent96c09687bce5e2dfb6f81eca705515a106d1c1a3 (diff)
downloadllvm-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.cpp6
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())