Skip to content

Commit 2c729d2

Browse files
committed
[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.
1 parent d6f0065 commit 2c729d2

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

llvm/lib/Analysis/AssumptionCache.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,7 @@ findAffectedValues(CallBase *CI, TargetTransformInfo *TTI,
6969

7070
// Peek through unary operators to find the source of the condition.
7171
Value *Op;
72-
if (match(I, m_BitCast(m_Value(Op))) ||
73-
match(I, m_PtrToInt(m_Value(Op))) || match(I, m_Not(m_Value(Op)))) {
72+
if (match(I, m_PtrToInt(m_Value(Op)))) {
7473
if (isa<Instruction>(Op) || isa<Argument>(Op))
7574
Affected.push_back({Op, Idx});
7675
}
@@ -85,6 +84,8 @@ findAffectedValues(CallBase *CI, TargetTransformInfo *TTI,
8584

8685
Value *Cond = CI->getArgOperand(0), *A, *B;
8786
AddAffected(Cond);
87+
if (match(Cond, m_Not(m_Value(A))))
88+
AddAffected(A);
8889

8990
CmpInst::Predicate Pred;
9091
if (match(Cond, m_Cmp(Pred, m_Value(A), m_Value(B)))) {

0 commit comments

Comments
 (0)