Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a compiler flag for the evaluateBuiltins pass #6450

Merged
merged 2 commits into from
Sep 7, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ For each boolean option, you can add a `no-` prefix to switch it off, such as `n
|`relaxed-float-in`|Bool|True|Use a more aggressive float-in pass, which often leads to reduced costs but may occasionally lead to slightly increased costs. Implied by `no-conservative-optimisation`.|
|`remove-trace`|Bool|False|Eliminate calls to `trace` from Plutus Core|
|`simplifier-beta`|Bool|True|Run a simplification pass that performs beta transformations|
|`simplifier-evaluate-builtins`|Bool|True|Run a simplification pass that evaluates fully saturated builtin applications. Implied by `no-conservative-optimisation`.|
|`simplifier-inline`|Bool|True|Run a simplification pass that performs inlining|
|`simplifier-remove-dead-bindings`|Bool|True|Run a simplification pass that removes dead bindings|
|`simplifier-unwrap-cancel`|Bool|True|Run a simplification pass that cancels unwrap/wrap pairs|
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

### Added

- A compiler flag `simplifier-evaluate-builtins` that controls whether to run the simplifier pass that evaluates fully saturated builtins at compile time.
7 changes: 7 additions & 0 deletions plutus-tx-plugin/src/PlutusTx/Options.hs
Original file line number Diff line number Diff line change
Expand Up @@ -171,10 +171,12 @@ pluginOptions =
, Implication (== True) posPreserveLogging True
, Implication (== True) posCaseOfCaseConservative True
, Implication (== True) posInlineConstants False
, Implication (== True) posDoSimplifierEvaluateBuiltins False
Copy link
Contributor

Choose a reason for hiding this comment

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

It gets turned off here because it may increase program size?

Copy link
Member Author

Choose a reason for hiding this comment

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

Because it may change semantics: #6167

, Implication (== False) posRelaxedFloatin True
, Implication (== False) posPreserveLogging False
, Implication (== False) posCaseOfCaseConservative False
, Implication (== False) posInlineConstants True
, Implication (== False) posDoSimplifierEvaluateBuiltins True
Copy link
Contributor

Choose a reason for hiding this comment

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

My OCD would prefer id over (== True) and not over (== False), but I guess it's currently more readable.

]
)
, let k = "context-level"
Expand Down Expand Up @@ -230,6 +232,11 @@ pluginOptions =
, let k = "simplifier-beta"
desc = "Run a simplification pass that performs beta transformations"
in (k, PluginOption typeRep (setTrue k) posDoSimplifierBeta desc [])
, let k = "simplifier-evaluate-builtins"
desc =
"Run a simplification pass that evaluates fully saturated builtin applications. \
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add some comments! To the pass itself and somewhere here, so that the user knows they are enabling a semantics-changing pass. At least the link to the issue.

\Implied by `no-conservative-optimisation`."
in (k, PluginOption typeRep (setTrue k) posDoSimplifierEvaluateBuiltins desc [])
, let k = "simplifier-inline"
desc = "Run a simplification pass that performs inlining"
in (k, PluginOption typeRep (setTrue k) posDoSimplifierInline desc [])
Expand Down