[PATCH] D91440: [flang] Fix "EQ" comparison of arrays

Pete Steinfeld via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 13 13:00:25 PST 2020


PeteSteinfeld added inline comments.


================
Comment at: flang/lib/Evaluate/shape.cpp:706
             }
+          } else { // Couldn't get the right extent
+            return false;
----------------
klausler wrote:
> Might be more readable if restructured.  Two possible ways:
> 
> for (int j{0}; j < n; ++j) {
>   auto leftDim{...}, rightDim{...};
>   if (!leftDim || !rightDim) { return false; }
>   if (*leftDim != *rightDim) { Say(...); return false; }
> }
> 
> or
> 
> for (int j{0}; j < n; ++j) {
>   if (auto leftDim{...}) {
>     if (auto rightDim{...}) {
>       if (*leftDim == *rightDim) {
>         continue;
>       }
>       Say(...);
>     }
>   }
>   return false;
> }
Thanks for the suggestions.  I like the first one.  I'll rework the code.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D91440



More information about the llvm-commits mailing list