aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Analysis/ValueTracking.cpp
diff options
context:
space:
mode:
authorJuneyoung Lee <aqjune@gmail.com>2021-05-02 12:02:02 +0900
committerJuneyoung Lee <aqjune@gmail.com>2021-05-02 12:03:55 +0900
commit64e768e8162a3d32049ed5c38fd533beecb0c9af (patch)
treef9d5f4bcbde0819863d861370d17ac8ddd2f6b81 /llvm/lib/Analysis/ValueTracking.cpp
parentff7f27fe67dbfb7b2c0788c0603fde2b245d1b40 (diff)
downloadllvm-64e768e8162a3d32049ed5c38fd533beecb0c9af.zip
llvm-64e768e8162a3d32049ed5c38fd533beecb0c9af.tar.gz
llvm-64e768e8162a3d32049ed5c38fd533beecb0c9af.tar.bz2
[ValueTracking] Improve impliesPoison to look into overflow intrinsics
This update supports the following transformation: ``` select(extract(mul_with_overflow(a, _), _), (a == 0), false) => and(extract(mul_with_overflow(a, _), _), (a == 0)) ``` which is correct because if `a` was poison the select's condition was also poison. This update is splitted from D101423.
Diffstat (limited to 'llvm/lib/Analysis/ValueTracking.cpp')
-rw-r--r--llvm/lib/Analysis/ValueTracking.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp
index 369ac42..e5b0345 100644
--- a/llvm/lib/Analysis/ValueTracking.cpp
+++ b/llvm/lib/Analysis/ValueTracking.cpp
@@ -5020,7 +5020,8 @@ static bool directlyImpliesPoison(const Value *ValAssumedPoison,
// 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))))
+ (match(ValAssumedPoison, m_ExtractValue(m_Specific(II))) ||
+ llvm::is_contained(II->arg_operands(), ValAssumedPoison)))
return true;
}
return false;