[flang-commits] [PATCH] D114827: [flang] Simplify IsSimplyContiguous() with new predicates

Peter Klausler via Phabricator via flang-commits flang-commits at lists.llvm.org
Tue Nov 30 16:13:12 PST 2021


klausler created this revision.
klausler added a reviewer: jeanPerier.
klausler added a project: Flang.
Herald added a subscriber: jdoerfert.
klausler requested review of this revision.

IsSimplyContiguous() can now be simplified by using the
new predicates recently added for such purposes.


https://reviews.llvm.org/D114827

Files:
  flang/lib/Evaluate/check-expression.cpp


Index: flang/lib/Evaluate/check-expression.cpp
===================================================================
--- flang/lib/Evaluate/check-expression.cpp
+++ flang/lib/Evaluate/check-expression.cpp
@@ -659,18 +659,12 @@
       // simple contiguity to allow their use in contexts like
       // data targets in pointer assignments with remapping.
       return true;
-    } else if (semantics::IsPointer(ultimate)) {
+    } else if (semantics::IsPointer(ultimate) ||
+        semantics::IsAssumedShape(ultimate)) {
       return false;
-    } else if (semantics::IsAllocatable(ultimate)) {
-      // TODO: this could be merged with the case below if
-      // details->IsAssumedShape() did not return true for allocatables. Current
-      // ArraySpec building in semantics does not allow making a difference
-      // between some_assumed_shape(:) and some_allocatable(:). Both
-      // isDeferredShape() and isAssumedShape() are true in each case.
-      return true;
     } else if (const auto *details{
                    ultimate.detailsIf<semantics::ObjectEntityDetails>()}) {
-      return !details->IsAssumedShape() && !details->IsAssumedRank();
+      return !details->IsAssumedRank();
     } else if (auto assoc{Base::operator()(ultimate)}) {
       return assoc;
     } else {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D114827.390850.patch
Type: text/x-patch
Size: 1294 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20211201/bddbbc3b/attachment-0001.bin>


More information about the flang-commits mailing list