-
Notifications
You must be signed in to change notification settings - Fork 328
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
Simplify case of
and pattern matching implementation
#12213
Comments
During my work on #11717, I figured out that the ultimate purpose of NestedPatternMatch compiler pass is to replace nested pattern constructors in case branches by new expression blocks that contain new Examples with screenshotsThe following expression:
is rewritten to:
where The following expression:
is rewritten to:
Both of these examples were generated by using assertInlineCompilation with Lines 362 to 427 in babc82e
Is this necessary?As noted in the issue description, this feels unnecessarily complicated. We should not attempt to do any optimization-like transformations on the IR ourselves, and should rather delegate this job to Truffle, which will certainly do a better job in this. Moreover, introducing new expression blocks and bindings smells with bad performance. |
Originally posted in #10507
if/then/else
into a construct and not a functionThe handling of
case of
pattern and itsBranchXyzNode
s were clearly created before Truffle was the target platform. As suchIR
Goals
IR
before/withoutNestedPatternMatch
inIrToTruffle
IfThenElse
IR to avoid 3x slower IfVsCaseBenchmarks_ifBench6In #9165?NestedPatternMatch
will be simplified/removedThe text was updated successfully, but these errors were encountered: