Skip to content

Merge dynamic constant propagation into the constprop pass - #146

Open
amarkdotdev wants to merge 1 commit into
google:mainfrom
amarkdotdev:merge-constprop-passes
Open

Merge dynamic constant propagation into the constprop pass#146
amarkdotdev wants to merge 1 commit into
google:mainfrom
amarkdotdev:merge-constprop-passes

Conversation

@amarkdotdev

Copy link
Copy Markdown

Ordinary and dynamic constant propagation run the same rewrite; the dynamic path only loads JsirDynamicConstantPropagationAnalysis (prelude matching) first. There is no reason for two MLIR pass classes.

JsirConstantPropagationPass now handles both JsirTransformConfig kinds. PerformDynamicConstantPropagation lives next to PerformConstantPropagation, and the old dynamic pass .cc is gone. CLI names (constprop / dynconstprop) and proto fields are unchanged.

Fixes #19

Both transforms apply the same rewrite; the dynamic path only swaps in a richer analysis. One MLIR pass now covers both configs.

Fixes google#19

Signed-off-by: Aaron <amark@g.jct.ac.il>
@phisiart

Copy link
Copy Markdown
Collaborator

Thanks for the contribution! We currently only have a process to sync internal changes to github, but not the opposite direction. I'll need to manually create a matching internal change and merge your PR at just the right time :) This will take some time (maybe several days) to figure out, so please be patient in the meantime.

// Transforms `op` using the dynamic constant propagation analysis.
//
// `babel` is used to minify the prelude.
// Dynamic constant propagation is the same rewrite as ordinary constant

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Can we do a more aggressive refactor:

Merge maldoca/js/ir/transforms/{constant_propagation,dynamic_constant_propagation} into a single directory;
Similarly, merge maldoca/js/ir/analyses/{constant_propagation,dynamic_constant_propagation} into a single directory;

Basically, we would just always run the dynamic version, and if the user doesn't provide a prelude, the algorithm naturally falls back to the non-dynamic version.

Let me know if this makes sense!

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.

Merge dynamic_constant_propagation and constant_propagation

2 participants