Skip to content

[OM] Fix object field value is considered fully evaluated even it's not#10293

Merged
uenoku merged 2 commits intollvm:mainfrom
uenoku:dev/hidetou/10264
Apr 22, 2026
Merged

[OM] Fix object field value is considered fully evaluated even it's not#10293
uenoku merged 2 commits intollvm:mainfrom
uenoku:dev/hidetou/10264

Conversation

@uenoku
Copy link
Copy Markdown
Member

@uenoku uenoku commented Apr 21, 2026

This fixes an issue that object field is considered as evaluated even when it's still pending. The fix itself was only:

if (!finalField->isFullyEvaluated())
    return objectFieldValue;

However this change forces a more proper cycle detection mechanism for dataflow cycle, so this PR also added a counter that tracks the number of fully evaluated values. I'm hoping to replace these fixes with more simpler solution that actually mutates the IR as mentioned in #10265

Fixes #10264.

Assisted-by: Augment: claude-sonnet-4.5

@uenoku uenoku requested a review from seldridge April 21, 2026 22:20
Copy link
Copy Markdown
Member

@seldridge seldridge left a comment

Choose a reason for hiding this comment

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

I have a couple of questions. This looks great, though. The two worklist approach makes a lot of sense and simplifies the cycle detection.

Comment thread include/circt/Dialect/OM/Evaluator/Evaluator.h Outdated
Comment thread lib/Dialect/OM/Evaluator/Evaluator.cpp Outdated
Comment on lines +673 to +675
// Test for issue #10264 - nested object field references that previously
// caused an assertion failure. This test verifies that the evaluator can
// properly handle nested field accesses without hitting null pointers.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nit: Please include a direct link tot he GitHub issue. Also, please rewrite this LLM-generated comment.

Copy link
Copy Markdown
Member Author

@uenoku uenoku Apr 21, 2026

Choose a reason for hiding this comment

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

Is there a policy for preferring a direct link over issue number? I don't have a strong opinion but certainly I've used both #<issue_number> and URL without much consideration. Certainly LLVM also doesn't have a policy for that, can you add to CIRCT coding guideine?

// Check direction of compatibility using const/non-const issue encountered (#6819).
firrtl.circuit "Issue6819" attributes {

https://github.com/llvm/llvm-project/blob/5892e34a96131821256f89c0555ba68c23c91dbe/mlir/test/Analysis/test-match-reduction.mlir#L118

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Sure. I can do that.

There's a significant trend towards full links, but both are used:

# grep  -r "\(;\|//\).*#[0-9]\+" ../test  | grep -v "\(CHECK\|expected\|CONN\)" | wc -l
      55
# grep  -r "https://github.com/llvm/circt/issues" ../test | wc -l
     237

Comment thread lib/Dialect/OM/Evaluator/Evaluator.cpp Outdated
Comment on lines +101 to +102
if (succeeded(result))
attachCounter(result.value());
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Given the checking in attachCounter, can this blindly call attachCounter(result.value())? I guess not given that the return type is FailureOr<...>? result.value() must then auto-unpack the FailureOr for you?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I think result.value() causes assertion failure for FailureOr::failuare(= std::nullopt), so we need to add a guard for this.

Comment thread lib/Dialect/OM/Evaluator/Evaluator.cpp Outdated
Comment thread lib/Dialect/OM/Evaluator/Evaluator.cpp Outdated
Comment thread lib/Dialect/OM/Evaluator/Evaluator.cpp Outdated
Comment thread lib/Dialect/OM/Evaluator/Evaluator.cpp Outdated
auto boolValue = llvm::cast<evaluator::AttributeValue>(fieldValue.get())
->getAs<BoolAttr>();
ASSERT_FALSE(boolValue.getValue());
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Very happy to see this working. Nice!

@uenoku uenoku merged commit 5ede804 into llvm:main Apr 22, 2026
6 checks passed
@uenoku uenoku deleted the dev/hidetou/10264 branch April 22, 2026 23:26
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.

[domaintool][OM] Assertion failure when bouncing through extra object

2 participants