Skip to content

feat(dataflow): fact subscribers#860

Closed
axelcool1234 wants to merge 1 commit into
opencompl:mainfrom
axelcool1234:fact-subscribers
Closed

feat(dataflow): fact subscribers#860
axelcool1234 wants to merge 1 commit into
opencompl:mainfrom
axelcool1234:fact-subscribers

Conversation

@axelcool1234

Copy link
Copy Markdown
Collaborator

This adds an extra field to Fact for analyses subscribed to it. This is much broader than a Fact f's dependents, which are for other Facts that need to be notified when f changes. Subscribers can be used to notify an arbitrary number of Facts of the subscribed analysis. This is used in both dead code analysis and sparse analyses like constant propagation analysis.

@axelcool1234 axelcool1234 marked this pull request as draft June 12, 2026 06:47
@axelcool1234 axelcool1234 marked this pull request as ready for review June 12, 2026 06:58
@axelcool1234 axelcool1234 requested review from math-fehr and regehr June 12, 2026 06:58
@math-fehr

Copy link
Copy Markdown
Collaborator

I am quite confused by your description, do you have an example on what would be the difference between subscribers and dependents?

@axelcool1234

Copy link
Copy Markdown
Collaborator Author

I am quite confused by your description, do you have an example on what would be the difference between subscribers and dependents?

@math-fehr I don't blame you I had trouble differentiating the two at first as well. Here's a good example: in dead code analysis, when a block goes from dead to live in the lattice, it enqueues the block and every single operation within that block for every analysis that's subscribed to it.

Now, you could have only dependents. But it's be an insane amount of dependents for some analyses. subscribers provide more flexibility and prevents this space explosion.

@math-fehr

Copy link
Copy Markdown
Collaborator

So what would subscribers do in that case?

@axelcool1234

Copy link
Copy Markdown
Collaborator Author

So what would subscribers do in that case?

@math-fehr for every subscribed analysis, it enqueues the pair (subscribed analysis, block) and (subscribed analysis, operation) for every operation in the block.

@axelcool1234

Copy link
Copy Markdown
Collaborator Author

So what would subscribers do in that case?

@math-fehr for every subscribed analysis, it enqueues the pair (subscribed analysis, block) and (subscribed analysis, operation) for every operation in the block.

Instead of having every single one of these pairs in dependents, which could be literally hundreds, you just have an analysis subscribe and it does this double for loop when dead code changes.

@axelcool1234

Copy link
Copy Markdown
Collaborator Author

Closed in favor of #859

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.

2 participants