Constant-fold icmp instructions (#5666)

We found examples of icmp instructions with both operands constant in
spidermonkey.wasm.
This commit is contained in:
Jamey Sharp
2023-02-01 13:55:36 -08:00
committed by GitHub
parent bdfb746548
commit ac4d28f4dd
5 changed files with 161 additions and 18 deletions

View File

@@ -70,6 +70,14 @@
(iconst ty k2)))
(subsume (iconst ty (imm64_sshr ty k1 k2))))
(rule (simplify
(icmp result_ty
cc
(iconst ty k1)
(iconst ty k2)))
(subsume (iconst result_ty (imm64_icmp ty cc k1 k2))))
;; Canonicalize via commutativity: push immediates to the right.
;;
;; (op k x) --> (op x k)