[PATCH] D111191: [SCEV] Search operand tree for scope bound when inferring flags from IR

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 6 14:41:32 PDT 2021


reames added inline comments.


================
Comment at: llvm/lib/Analysis/ScalarEvolution.cpp:6622
+        Bound = DefI;
+    } if (auto *S2 = dyn_cast<SCEVCastExpr>(S))
+      for (auto *Op : S2->operands())
----------------
nikic wrote:
> Is an `else` missing here? We probably don't want to recurse through addrecs here, as the addrec will already have the smallest scope.
Er, yes, yes it is.  Good catch.  :)


================
Comment at: llvm/lib/Analysis/ScalarEvolution.cpp:6630
+      for (auto *Op : S2->operands())
+        pushOp(Op);
+
----------------
nikic wrote:
> Huh, I'm surprised we don't have a simpler way to write this.
Me too honestly.  Closest alternative I could find was to use a visitor to recurse through all the operands, but that seemed worse.  


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D111191/new/

https://reviews.llvm.org/D111191



More information about the llvm-commits mailing list