aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Analysis/AssumptionCache.cpp
diff options
context:
space:
mode:
authorNikita Popov <npopov@redhat.com>2023-11-28 14:22:14 +0100
committerNikita Popov <npopov@redhat.com>2023-11-28 14:31:16 +0100
commit2c729d29aa1390253508c19b4d83dbedb233098d (patch)
tree736b3abc75c3f51bb4e3965e17aecadef3c1dbba /llvm/lib/Analysis/AssumptionCache.cpp
parentd6f00654fbc686f5413f9c8d1bac2c4050fdf350 (diff)
downloadllvm-2c729d29aa1390253508c19b4d83dbedb233098d.zip
llvm-2c729d29aa1390253508c19b4d83dbedb233098d.tar.gz
llvm-2c729d29aa1390253508c19b4d83dbedb233098d.tar.bz2
[AssumptionCache] Remove unnecessary bitcast/not handling
We only handle not for the top level value of the condition, so move it there instead of trying to look through not at all leafs. Also remove bitcast handling entirely -- we don't do anything special wrt bitcasts, this is probably a leftover from pointer types.
Diffstat (limited to 'llvm/lib/Analysis/AssumptionCache.cpp')
-rw-r--r--llvm/lib/Analysis/AssumptionCache.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/lib/Analysis/AssumptionCache.cpp b/llvm/lib/Analysis/AssumptionCache.cpp
index 3139b3e..fb3a6f8 100644
--- a/llvm/lib/Analysis/AssumptionCache.cpp
+++ b/llvm/lib/Analysis/AssumptionCache.cpp
@@ -69,8 +69,7 @@ findAffectedValues(CallBase *CI, TargetTransformInfo *TTI,
// Peek through unary operators to find the source of the condition.
Value *Op;
- if (match(I, m_BitCast(m_Value(Op))) ||
- match(I, m_PtrToInt(m_Value(Op))) || match(I, m_Not(m_Value(Op)))) {
+ if (match(I, m_PtrToInt(m_Value(Op)))) {
if (isa<Instruction>(Op) || isa<Argument>(Op))
Affected.push_back({Op, Idx});
}
@@ -85,6 +84,8 @@ findAffectedValues(CallBase *CI, TargetTransformInfo *TTI,
Value *Cond = CI->getArgOperand(0), *A, *B;
AddAffected(Cond);
+ if (match(Cond, m_Not(m_Value(A))))
+ AddAffected(A);
CmpInst::Predicate Pred;
if (match(Cond, m_Cmp(Pred, m_Value(A), m_Value(B)))) {