[PATCH] D95894: [flang] Fix calls to LBOUND() intrinsic for arrays with lower bounds not 1

Tim Keith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 2 18:57:39 PST 2021


tskeith added inline comments.


================
Comment at: flang/lib/Evaluate/fold-integer.cpp:91
+        return Expr<T>{GetConstantArrayLboundHelper{*dim}.GetLbound(*array)};
+      }
       if (lowerBoundsAreOne) {
----------------
I noticed we already have `UnwrapConstantValue`, so I think you could write this as:
```
      if (auto *constant{UnwrapConstantValue(*array)}) {
        return Expr<T>(constant->lbounds()[*dim]);
      }
```


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D95894



More information about the llvm-commits mailing list