Cranelift: GVN uadd_overflow_trap (#5520)
* Switch duplicate loads w/ dynamic memories test to `min_size = 0` This test was accidentally hitting a special case for bounds checks for when we know that `offset + access_size < min_size` and can skip some steps. This commit changes the `min_size` of the memory to zero so that we are forced to do fully general bounds checks. * Cranelift: Mark `uadd_overflow_trap` as okay for GVN Although this improves our test sequence for duplicate loads with dynamic memories, it unfortunately doesn't have any effect on sightglass benchmarks: ``` instantiation :: instructions-retired :: benchmarks/pulldown-cmark/benchmark.wasm No difference in performance. [34448 35607.23 37158] gvn_uadd_overflow_trap.so [34566 35734.05 36585] main.so instantiation :: instructions-retired :: benchmarks/spidermonkey/benchmark.wasm No difference in performance. [44101 60449.62 92712] gvn_uadd_overflow_trap.so [44011 60436.37 92690] main.so instantiation :: instructions-retired :: benchmarks/bz2/benchmark.wasm No difference in performance. [35595 36675.72 38153] gvn_uadd_overflow_trap.so [35440 36670.42 37993] main.so compilation :: instructions-retired :: benchmarks/bz2/benchmark.wasm No difference in performance. [17370195 17405125.62 17471222] gvn_uadd_overflow_trap.so [17369324 17404859.43 17470725] main.so execution :: instructions-retired :: benchmarks/spidermonkey/benchmark.wasm No difference in performance. [7055720520 7055886880.32 7056265930] gvn_uadd_overflow_trap.so [7055719554 7055843809.33 7056193289] main.so compilation :: instructions-retired :: benchmarks/spidermonkey/benchmark.wasm No difference in performance. [683589861 683767276.00 684098366] gvn_uadd_overflow_trap.so [683590024 683767998.02 684097885] main.so execution :: instructions-retired :: benchmarks/pulldown-cmark/benchmark.wasm No difference in performance. [46436883 46437135.10 46437823] gvn_uadd_overflow_trap.so [46436883 46437087.67 46437785] main.so compilation :: instructions-retired :: benchmarks/pulldown-cmark/benchmark.wasm No difference in performance. [126522461 126565812.58 126647044] gvn_uadd_overflow_trap.so [126522176 126565757.75 126647522] main.so execution :: instructions-retired :: benchmarks/bz2/benchmark.wasm No difference in performance. [653010531 653010533.03 653010544] gvn_uadd_overflow_trap.so [653010531 653010533.18 653010537] main.so ``` * cranelift-codegen-meta: Rename `side_effects_okay_for_gvn` to `side_effects_idempotent` * cranelift-filetests: Ensure there is a trailing newline for blessed Wasm tests
This commit is contained in:
@@ -74,7 +74,7 @@ pub(crate) struct InstructionContent {
|
||||
/// Does this instruction have other side effects besides can_* flags?
|
||||
pub other_side_effects: bool,
|
||||
/// Despite having other side effects, is this instruction okay to GVN?
|
||||
pub side_effects_okay_for_gvn: bool,
|
||||
pub side_effects_idempotent: bool,
|
||||
}
|
||||
|
||||
impl InstructionContent {
|
||||
@@ -135,7 +135,7 @@ pub(crate) struct InstructionBuilder {
|
||||
can_store: bool,
|
||||
can_trap: bool,
|
||||
other_side_effects: bool,
|
||||
side_effects_okay_for_gvn: bool,
|
||||
side_effects_idempotent: bool,
|
||||
}
|
||||
|
||||
impl InstructionBuilder {
|
||||
@@ -155,7 +155,7 @@ impl InstructionBuilder {
|
||||
can_store: false,
|
||||
can_trap: false,
|
||||
other_side_effects: false,
|
||||
side_effects_okay_for_gvn: false,
|
||||
side_effects_idempotent: false,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -215,8 +215,8 @@ impl InstructionBuilder {
|
||||
self
|
||||
}
|
||||
|
||||
pub fn side_effects_okay_for_gvn(mut self, val: bool) -> Self {
|
||||
self.side_effects_okay_for_gvn = val;
|
||||
pub fn side_effects_idempotent(mut self, val: bool) -> Self {
|
||||
self.side_effects_idempotent = val;
|
||||
self
|
||||
}
|
||||
|
||||
@@ -268,7 +268,7 @@ impl InstructionBuilder {
|
||||
can_store: self.can_store,
|
||||
can_trap: self.can_trap,
|
||||
other_side_effects: self.other_side_effects,
|
||||
side_effects_okay_for_gvn: self.side_effects_okay_for_gvn,
|
||||
side_effects_idempotent: self.side_effects_idempotent,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user