Skip to content

Commit 3d0fa76

Browse files
committed
Bug 1990510: Add congruentTo for MWasmBoundsCheck. r=rhunt
Two bounds checks on exactly the same values are obviously redundant and can be GVN'd. Differential Revision: https://phabricator.services.mozilla.com/D265998
1 parent 290121d commit 3d0fa76

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

js/src/jit/MIR-wasm.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -788,14 +788,18 @@ class MWasmBoundsCheck : public MBinaryInstruction, public NoTypePolicy::Data {
788788

789789
AliasSet getAliasSet() const override { return AliasSet::None(); }
790790

791+
const wasm::TrapSiteDesc& trapSiteDesc() const { return trapSiteDesc_; }
791792
Target target() const { return target_; }
792793
uint32_t targetIndex() const { return targetIndex_; }
793794

794795
bool isRedundant() const { return !isGuard(); }
795-
796796
void setRedundant() { setNotGuard(); }
797797

798-
const wasm::TrapSiteDesc& trapSiteDesc() const { return trapSiteDesc_; }
798+
bool congruentTo(const MDefinition* ins) const override {
799+
return congruentIfOperandsEqual(ins) &&
800+
ins->toWasmBoundsCheck()->target() == target() &&
801+
ins->toWasmBoundsCheck()->targetIndex() == targetIndex();
802+
}
799803

800804
ALLOW_CLONE(MWasmBoundsCheck)
801805
};

0 commit comments

Comments
 (0)