================
@@ -83,6 +86,293 @@ struct UnwrapStmt<parser::UnlabeledStatement<A>> {
 void dumpScope(const semantics::Scope *scope, int depth = -1);
 #endif
 
+/// Collect direct storage uses while retaining complex expressions on the
+/// existing storage path. Skipped nodes do not seed selection from their
+/// children.
+struct MainSymbolVisitor
+    : public evaluate::AllTraverse<MainSymbolVisitor, true, false> {
+  using Base = evaluate::AllTraverse<MainSymbolVisitor, true, false>;
+  /// Borrow the callback for one synchronous expression walk.
+  explicit MainSymbolVisitor(
+      llvm::function_ref<void(const semantics::Symbol &)> callback)
+      : Base{*this}, callback{callback} {}
+  using Base::operator();
+  /// Stream each direct symbol occurrence without building subtree sets.
+  bool operator()(const semantics::Symbol &symbol) const {
+    LLVM_DEBUG(llvm::dbgs() << "main-global symbol\n");
+    callback(symbol);
+    return true;
+  }
+  /// TODO: Collect runtime dependencies of calls, constructors, PDT parameters
+  /// and coarray references, excluding metadata and folded payloads and
+  /// avoiding copies of selector expressions.
+  bool operator()(const semantics::DerivedTypeSpec &) const { return true; }
+  /// Computed derived constants cannot add direct storage uses.
+  bool operator()(const evaluate::Constant<evaluate::SomeDerived> &) const {
+    return true;
+  }
+  bool operator()(const evaluate::CoarrayRef &) const { return true; }
+  bool operator()(const evaluate::ProcedureRef &) const { return true; }
----------------
SergeyShch01 wrote:

Done. Value arguments of elemental intrinsics such as `ABS` now contribute to 
selection, so wrapping `dy` in `abs(dy)` no longer prevents its promotion. 
Arguments used only for type, kind or rank inquiries remain excluded.


https://github.com/llvm/llvm-project/pull/236384
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to