[PATCH] D86083: [SCEV] Add operand methods to Exprs

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 17 08:48:02 PDT 2020


lebedev.ri requested changes to this revision.
lebedev.ri added inline comments.
This revision now requires changes to proceed.


================
Comment at: llvm/include/llvm/Analysis/ScalarEvolutionExpressions.h:77
   protected:
-    const SCEV *Op;
+    std::array<const SCEV*, 1> Operands;
     Type *Ty;
----------------
I do not understand why you need `std::array` here.
```
    op_range operands() const {
      return make_range(Op, Op+1);
    }
```
will just work


================
Comment at: llvm/include/llvm/Analysis/ScalarEvolutionExpressions.h:296-298
+    op_iterator op_end() const { return &Operands[1]; }
+    op_range operands() const {
+      return make_range(op_begin(), op_end());
----------------
Again, `end()` should be one-past-the-last element, not the last element.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D86083



More information about the llvm-commits mailing list