Skip to content

Commit e6c302e

Browse files
authored
[NFC] Properly mark ConstantFieldPropagation as requiring closed-world (#8007)
The fuzzer only had one variant of the pass marked that way. Also, we were missing the explicit error.
1 parent d0156b4 commit e6c302e

File tree

7 files changed

+10
-5
lines changed

7 files changed

+10
-5
lines changed

scripts/fuzz_opt.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2370,6 +2370,7 @@ def write_commands(commands, filename):
23702370
("--remove-unused-types",),
23712371
("--abstract-type-refining",),
23722372
("--cfp",),
2373+
("--cfp-reftest",),
23732374
("--gsi",),
23742375
("--type-ssa",),
23752376
("--type-merging",)}

src/passes/ConstantFieldPropagation.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -549,6 +549,10 @@ struct ConstantFieldPropagation : public Pass {
549549
return;
550550
}
551551

552+
if (!getPassOptions().closedWorld) {
553+
Fatal() << "CFP requires --closed-world";
554+
}
555+
552556
// Find and analyze all writes inside each function.
553557
PCVFunctionStructValuesMap functionNewInfos(*module),
554558
functionSetInfos(*module);

test/lit/passes/cfp-desc.wast

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
;; NOTE: Assertions have been generated by update_lit_checks.py --all-items and should not be edited.
22

3-
;; RUN: foreach %s %t wasm-opt --cfp -all -S -o - | filecheck %s
3+
;; RUN: foreach %s %t wasm-opt --cfp --closed-world -all -S -o - | filecheck %s
44

55
(module
66
(rec

test/lit/passes/cfp-reftest-desc.wast

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
;; NOTE: Assertions have been generated by update_lit_checks.py --all-items and should not be edited.
22

3-
;; RUN: foreach %s %t wasm-opt --cfp-reftest -all -S -o - | filecheck %s
3+
;; RUN: foreach %s %t wasm-opt --cfp-reftest --closed-world -all -S -o - | filecheck %s
44

55
;; When a ref.get_desc can only read from two types, and those types have a
66
;; constant field, we can select between those two values using a ref.test.

test/lit/passes/cfp-reftest.wast

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
;; NOTE: Assertions have been generated by update_lit_checks.py --all-items and should not be edited.
22

3-
;; RUN: foreach %s %t wasm-opt --cfp-reftest -all -S -o - | filecheck %s
3+
;; RUN: foreach %s %t wasm-opt --cfp-reftest --closed-world -all -S -o - | filecheck %s
44

55
;; When a struct.get can only read from two types, and those types have a
66
;; constant field, we can select between those two values using a ref.test.

test/lit/passes/cfp-rmw.wast

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
;; NOTE: Assertions have been generated by update_lit_checks.py --all-items and should not be edited.
22

3-
;; RUN: foreach %s %t wasm-opt --cfp -all -S -o - | filecheck %s
3+
;; RUN: foreach %s %t wasm-opt --cfp --closed-world -all -S -o - | filecheck %s
44

55
;; RMW ops are generally writes that inhibit optimization.
66
(module

test/lit/passes/cfp.wast

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
;; NOTE: Assertions have been generated by update_lit_checks.py --all-items and should not be edited.
22

3-
;; RUN: foreach %s %t wasm-opt --remove-unused-names --cfp -all -S -o - | filecheck %s
3+
;; RUN: foreach %s %t wasm-opt --remove-unused-names --cfp --closed-world -all -S -o - | filecheck %s
44

55
;; (remove-unused-names is added to test fallthrough values without a block
66
;; name getting in the way)

0 commit comments

Comments
 (0)