aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Analysis/ValueTracking.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Analysis/ValueTracking.cpp')
-rw-r--r--llvm/lib/Analysis/ValueTracking.cpp18
1 files changed, 13 insertions, 5 deletions
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp
index 600509f..0491941 100644
--- a/llvm/lib/Analysis/ValueTracking.cpp
+++ b/llvm/lib/Analysis/ValueTracking.cpp
@@ -4870,11 +4870,19 @@ static bool directlyImpliesPoison(const Value *ValAssumedPoison,
if (Depth >= MaxDepth)
return false;
- const auto *I = dyn_cast<Instruction>(V);
- if (I && propagatesPoison(cast<Operator>(I))) {
- return any_of(I->operands(), [=](const Value *Op) {
- return directlyImpliesPoison(ValAssumedPoison, Op, Depth + 1);
- });
+ if (const auto *I = dyn_cast<Instruction>(V)) {
+ if (propagatesPoison(cast<Operator>(I)))
+ return any_of(I->operands(), [=](const Value *Op) {
+ return directlyImpliesPoison(ValAssumedPoison, Op, Depth + 1);
+ });
+
+ // V = extractvalue V0, idx
+ // V2 = extractvalue V0, idx2
+ // V0's elements are all poison or not. (e.g., add_with_overflow)
+ const WithOverflowInst *II;
+ if (match(I, m_ExtractValue(m_WithOverflowInst(II))) &&
+ match(ValAssumedPoison, m_ExtractValue(m_Specific(II))))
+ return true;
}
return false;
}