aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Analysis/CodeMetrics.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2021-11-19 20:06:13 +0000
committerDimitry Andric <dim@FreeBSD.org>2021-11-19 20:06:13 +0000
commitc0981da47d5696fe36474fcf86b4ce03ae3ff818 (patch)
treef42add1021b9f2ac6a69ac7cf6c4499962739a45 /llvm/lib/Analysis/CodeMetrics.cpp
parent344a3780b2e33f6ca763666c380202b18aab72a3 (diff)
Diffstat (limited to 'llvm/lib/Analysis/CodeMetrics.cpp')
-rw-r--r--llvm/lib/Analysis/CodeMetrics.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/lib/Analysis/CodeMetrics.cpp b/llvm/lib/Analysis/CodeMetrics.cpp
index 8c8e2ee6627f..27c52506352f 100644
--- a/llvm/lib/Analysis/CodeMetrics.cpp
+++ b/llvm/lib/Analysis/CodeMetrics.cpp
@@ -34,8 +34,9 @@ appendSpeculatableOperands(const Value *V,
for (const Value *Operand : U->operands())
if (Visited.insert(Operand).second)
- if (isSafeToSpeculativelyExecute(Operand))
- Worklist.push_back(Operand);
+ if (const auto *I = dyn_cast<Instruction>(Operand))
+ if (!I->mayHaveSideEffects() && !I->isTerminator())
+ Worklist.push_back(I);
}
static void completeEphemeralValues(SmallPtrSetImpl<const Value *> &Visited,