[flang-commits] [PATCH] D114756: [flang] Address TODO from previous changes to IsSaved()

Peter Klausler via Phabricator via flang-commits flang-commits at lists.llvm.org
Tue Nov 30 10:40:03 PST 2021


This revision was automatically updated to reflect the committed changes.
Closed by commit rG8bc593cbbb1a: [flang] Address TODO from previous changes to IsSaved() (authored by klausler).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114756

Files:
  flang/lib/Evaluate/tools.cpp


Index: flang/lib/Evaluate/tools.cpp
===================================================================
--- flang/lib/Evaluate/tools.cpp
+++ flang/lib/Evaluate/tools.cpp
@@ -1207,10 +1207,8 @@
     return false; // this is a component
   } else if (symbol.attrs().test(Attr::SAVE)) {
     return true; // explicit SAVE attribute
-  } else if (symbol.test(Symbol::Flag::InDataStmt)) {
-    return true;
   } else if (IsDummy(symbol) || IsFunctionResult(symbol) ||
-      IsAutomatic(symbol)) {
+      IsAutomatic(symbol) || IsNamedConstant(symbol)) {
     return false;
   } else if (scopeKind == Scope::Kind::Module ||
       (scopeKind == Scope::Kind::MainProgram &&
@@ -1228,13 +1226,8 @@
     // -fno-automatic/-save/-Msave option applies to objects in
     // executable subprograms unless they are explicitly RECURSIVE.
     return true;
-  } else if (IsNamedConstant(symbol)) {
-    // TODO: lowering needs named constants in modules to be static,
-    // so this test for a named constant has lower precedence for the
-    // time being; when lowering is corrected, this case should be
-    // moved up above module logic, since named constants don't really
-    // have implied SAVE attributes.
-    return false;
+  } else if (symbol.test(Symbol::Flag::InDataStmt)) {
+    return true;
   } else if (const auto *object{symbol.detailsIf<ObjectEntityDetails>()};
              object && object->init()) {
     return true;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D114756.390755.patch
Type: text/x-patch
Size: 1430 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20211130/b5464888/attachment.bin>


More information about the flang-commits mailing list