[llvm] [Delinearization] Modernize loops (NFC) (PR #146151)

Ryotaro Kasuga via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 30 02:52:53 PDT 2025


================
@@ -489,9 +487,9 @@ bool llvm::getIndexExpressionsFromGEP(ScalarEvolution &SE,
   assert(GEP && "getIndexExpressionsFromGEP called with a null GEP");
   Type *Ty = nullptr;
   bool DroppedFirstDim = false;
-  for (unsigned i = 1; i < GEP->getNumOperands(); i++) {
-    const SCEV *Expr = SE.getSCEV(GEP->getOperand(i));
-    if (i == 1) {
+  for (const auto [Idx, Op] : drop_begin(enumerate(GEP->operands()))) {
----------------
kasuga-fj wrote:

```suggestion
  for (const auto &[Idx, Op] : drop_begin(enumerate(GEP->operands()))) {
```

In addition, this function should be removed because it uses the GEP source element type for its optimization heuristics. IMHO, such a function should not be modified unless it causes a serious issue.

https://github.com/llvm/llvm-project/pull/146151


More information about the llvm-commits mailing list