Skip to content

Conversation

uenoku
Copy link
Member

@uenoku uenoku commented Jul 3, 2025

Add LongestPathCollection class to manage and own path data

@uenoku uenoku requested a review from Copilot July 3, 2025 22:36
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces a LongestPathCollection helper to encapsulate path storage, sorting, and deduplication, and refactors the existing pass to use it instead of ad-hoc vectors.

  • Add LongestPathCollection (with sort & dedupe methods) and store the MLIR context in LongestPathAnalysis
  • Refactor PrintLongestPathAnalysisPass to use the collection for gathering, sorting, and filtering paths
  • Update headers with necessary includes and declare the new helper struct

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
lib/Dialect/AIG/Analysis/PrintLongestPathAnalysis.cpp Refactor to use LongestPathCollection, simplify path management and printing logic
lib/Dialect/AIG/Analysis/LongestPathAnalysis.cpp Initialize and store context in LongestPathAnalysis; implement LongestPathCollection methods
include/circt/Dialect/AIG/Analysis/LongestPathAnalysis.h Add context member & accessor, include headers, and declare LongestPathCollection
Comments suppressed due to low confidence (3)

lib/Dialect/AIG/Analysis/PrintLongestPathAnalysis.cpp:96

  • [nitpick] The alias longestPathForEachFanOut may be confused with the old vector; consider renaming it to something like criticalPaths or uniqueFanOutPaths.
  auto &longestPathForEachFanOut = collection.paths;

include/circt/Dialect/AIG/Analysis/LongestPathAnalysis.h:247

  • The return type MLIRContext should be fully qualified as mlir::MLIRContext to match the member declaration and avoid lookup errors.
  MLIRContext *getContext() const { return ctx; }

include/circt/Dialect/AIG/Analysis/LongestPathAnalysis.h:27

  • Add #include "llvm/ADT/DenseSet.h" so that llvm::DenseSet used in sortAndDropNonCriticalPathsPerFanOut is declared.
#include "llvm/ADT/SmallVector.h"

Add LongestPathCollection class to manage and own path data
@uenoku uenoku force-pushed the dev/hidetou/collection-2 branch from 9a8121f to fde061a Compare July 3, 2025 22:38
@uenoku uenoku merged commit 796f83b into llvm:main Jul 3, 2025
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant