[llvm] 2c729d2 - [AssumptionCache] Remove unnecessary bitcast/not handling

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 28 05:31:25 PST 2023


Author: Nikita Popov
Date: 2023-11-28T14:31:16+01:00
New Revision: 2c729d29aa1390253508c19b4d83dbedb233098d

URL: https://github.com/llvm/llvm-project/commit/2c729d29aa1390253508c19b4d83dbedb233098d
DIFF: https://github.com/llvm/llvm-project/commit/2c729d29aa1390253508c19b4d83dbedb233098d.diff

LOG: [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.

Added: 
    

Modified: 
    llvm/lib/Analysis/AssumptionCache.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Analysis/AssumptionCache.cpp b/llvm/lib/Analysis/AssumptionCache.cpp
index 3139b3e8f319099..fb3a6f8de2d6ac5 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)))) {


        


More information about the llvm-commits mailing list