[llvm] b0ef5a8 - [NFC][SCEV] `SCEVTraversal::visitAll()`: deduplicate handling

Roman Lebedev via llvm-commits llvm-commits at lists.llvm.org
Sat Jan 21 18:04:02 PST 2023


Author: Roman Lebedev
Date: 2023-01-22T05:03:42+03:00
New Revision: b0ef5a82e9aa5076b117c4122a95669f63b81876

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

LOG: [NFC][SCEV] `SCEVTraversal::visitAll()`: deduplicate handling

They don't not do anything different from what we do for n-ary expressions,
there is no point in special-casing them.

Added: 
    

Modified: 
    llvm/include/llvm/Analysis/ScalarEvolutionExpressions.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/Analysis/ScalarEvolutionExpressions.h b/llvm/include/llvm/Analysis/ScalarEvolutionExpressions.h
index a9a46cc29688..80443510d449 100644
--- a/llvm/include/llvm/Analysis/ScalarEvolutionExpressions.h
+++ b/llvm/include/llvm/Analysis/ScalarEvolutionExpressions.h
@@ -677,28 +677,21 @@ template <typename SV> class SCEVTraversal {
       case scTruncate:
       case scZeroExtend:
       case scSignExtend:
-        push(cast<SCEVCastExpr>(S)->getOperand());
-        continue;
       case scAddExpr:
       case scMulExpr:
+      case scUDivExpr:
       case scSMaxExpr:
       case scUMaxExpr:
       case scSMinExpr:
       case scUMinExpr:
       case scSequentialUMinExpr:
       case scAddRecExpr:
-        for (const auto *Op : cast<SCEVNAryExpr>(S)->operands()) {
+        for (const auto *Op : S->operands()) {
           push(Op);
           if (Visitor.isDone())
             break;
         }
         continue;
-      case scUDivExpr: {
-        const SCEVUDivExpr *UDiv = cast<SCEVUDivExpr>(S);
-        push(UDiv->getLHS());
-        push(UDiv->getRHS());
-        continue;
-      }
       case scCouldNotCompute:
         llvm_unreachable("Attempt to use a SCEVCouldNotCompute object!");
       }


        


More information about the llvm-commits mailing list