[zeek/spicy] 74d86c: Fix optimizer phases not returning to previous.

0 views
Skip to first unread message

Evan Typanski

unread,
Sep 3, 2025, 10:37:02 AM (6 days ago) Sep 3
to spicy-...@zeek.org
Branch: refs/heads/topic/etyp/not-null-coercions-fix
Home: https://github.com/zeek/spicy
Commit: 74d86c6c57da04219835077cf4b17e5bac289c2a
https://github.com/zeek/spicy/commit/74d86c6c57da04219835077cf4b17e5bac289c2a
Author: Evan Typanski <evan.t...@corelight.com>
Date: 2025-09-03 (Wed, 03 Sep 2025)

Changed paths:
M hilti/toolchain/src/compiler/optimizer.cc

Log Message:
-----------
Fix optimizer phases not returning to previous.

Since the outer modified was continuously set to `false` this would
cause incorrect results. The outer `modified` would always be false when
it broke out of phases.


Commit: abfb8a2146034f13c5f139ea54294a6c2d0aa0bd
https://github.com/zeek/spicy/commit/abfb8a2146034f13c5f139ea54294a6c2d0aa0bd
Author: Evan Typanski <evan.t...@corelight.com>
Date: 2025-09-03 (Wed, 03 Sep 2025)

Changed paths:
M hilti/toolchain/src/compiler/optimizer.cc

Log Message:
-----------
Use the correct form of `deepcopy`.

I let my tab-completed one stay on accident :(


Commit: f543e63d609c6b8c805d735f3bfe116472f60346
https://github.com/zeek/spicy/commit/f543e63d609c6b8c805d735f3bfe116472f60346
Author: Evan Typanski <evan.t...@corelight.com>
Date: 2025-09-03 (Wed, 03 Sep 2025)

Changed paths:
M hilti/toolchain/include/compiler/detail/optimizer.h
M hilti/toolchain/src/ast/ast-context.cc
M hilti/toolchain/src/compiler/optimizer.cc
M tests/Baseline/hilti.ast.basic-module/debug.log
M tests/Baseline/hilti.ast.imported-id/output
M tests/Baseline/hilti.ast.types/output
M tests/Baseline/hilti.expressions.ctor-replacement/output

Log Message:
-----------
Run all optimizations until convergence.

This is the first step to get the optimizer to play nicely with
coercion. We run resolution/coercion after optimization, but if we want
tho optimizer to play nice with newly-coerced results, we have to run
the optimizer after the coercion as well. This way, changes in coercion
from constant propagation can make other optimizations run.


Commit: a8681a05c082efe97ee73b70747825ae2cd01d0a
https://github.com/zeek/spicy/commit/a8681a05c082efe97ee73b70747825ae2cd01d0a
Author: Evan Typanski <evan.t...@corelight.com>
Date: 2025-09-03 (Wed, 03 Sep 2025)

Changed paths:
M hilti/toolchain/src/compiler/coercer.cc
M hilti/toolchain/src/compiler/optimizer.cc
M tests/Baseline/spicy.optimization.default-parser-functions/log
M tests/Baseline/spicy.optimization.default-parser-functions/opt.hlt
M tests/Baseline/spicy.optimization.feature_requirements/log
M tests/Baseline/spicy.optimization.feature_requirements/opt.hlt
M tests/Baseline/spicy.optimization.unused-functions/log
M tests/Baseline/spicy.optimization.unused-functions/opt.hlt
M tests/Baseline/spicy.optimization.unused-types/log
M tests/Baseline/spicy.optimization.unused-types/opt.hlt
M tests/Baseline/spicy.rt.debug-trace/.stderr
M tests/Baseline/spicy.types.unit.canonical-ids-with-import/output
M tests/Baseline/spicy.types.unit.canonical-ids/output

Log Message:
-----------
Coerce `Null` to false and optimize it.

Fixes #2150

This does 2 things:

1) Makes Null (and null-like-things, like a strong ref ctor) coerce to
False when coercing to a boolean.
2) Allows the optimizer to work with boolean coercions.

In turn, this lets the optimizer get rid of `if (!Null)` checks that got
constant propagated from a previous optimizer run.


Commit: 54ef84e0fee779bc68f8795c4ec6047de7311b88
https://github.com/zeek/spicy/commit/54ef84e0fee779bc68f8795c4ec6047de7311b88
Author: Evan Typanski <evan.t...@corelight.com>
Date: 2025-09-03 (Wed, 03 Sep 2025)

Changed paths:
M hilti/toolchain/include/compiler/detail/cfg.h
M hilti/toolchain/src/ast/ast-context.cc
M hilti/toolchain/src/compiler/cfg.cc
M hilti/toolchain/src/compiler/optimizer.cc

Log Message:
-----------
Move CFG printing from optimizer to `ASTContext`.


Compare: https://github.com/zeek/spicy/compare/68671c1819aa...54ef84e0fee7

To unsubscribe from these emails, change your notification settings at https://github.com/zeek/spicy/settings/notifications

Evan Typanski

unread,
Sep 3, 2025, 11:21:08 AM (6 days ago) Sep 3
to spicy-...@zeek.org
Branch: refs/heads/main
Commit: de3db05669619a030ab31d8e9538d3064db5bc4e
https://github.com/zeek/spicy/commit/de3db05669619a030ab31d8e9538d3064db5bc4e
Author: Evan Typanski <evan.t...@corelight.com>
Date: 2025-09-03 (Wed, 03 Sep 2025)

Changed paths:
M CHANGES
M VERSION
M hilti/toolchain/include/compiler/detail/cfg.h
M hilti/toolchain/include/compiler/detail/optimizer.h
M hilti/toolchain/src/ast/ast-context.cc
M hilti/toolchain/src/compiler/cfg.cc
M hilti/toolchain/src/compiler/coercer.cc
M hilti/toolchain/src/compiler/optimizer.cc
M tests/Baseline/hilti.ast.basic-module/debug.log
M tests/Baseline/hilti.ast.imported-id/output
M tests/Baseline/hilti.ast.types/output
M tests/Baseline/hilti.expressions.ctor-replacement/output
M tests/Baseline/spicy.optimization.default-parser-functions/log
M tests/Baseline/spicy.optimization.default-parser-functions/opt.hlt
M tests/Baseline/spicy.optimization.feature_requirements/log
M tests/Baseline/spicy.optimization.feature_requirements/opt.hlt
M tests/Baseline/spicy.optimization.unused-functions/log
M tests/Baseline/spicy.optimization.unused-functions/opt.hlt
M tests/Baseline/spicy.optimization.unused-types/log
M tests/Baseline/spicy.optimization.unused-types/opt.hlt
M tests/Baseline/spicy.rt.debug-trace/.stderr
M tests/Baseline/spicy.types.unit.canonical-ids-with-import/output
M tests/Baseline/spicy.types.unit.canonical-ids/output

Log Message:
-----------
Merge remote-tracking branch 'origin/topic/etyp/not-null-coercions-fix'

* origin/topic/etyp/not-null-coercions-fix:
Move CFG printing from optimizer to `ASTContext`.
Coerce `Null` to false and optimize it.
Run all optimizations until convergence.
Use the correct form of `deepcopy`.
Fix optimizer phases not returning to previous.


Compare: https://github.com/zeek/spicy/compare/3c6c7f230233...de3db0566961
Reply all
Reply to author
Forward
0 new messages