cranelift: simplify x-x to 0 (#6032)
* cranelift: simplify `x-x` to `0` * Guard `x-x => 0` rewrite with `fits_in_64`
This commit is contained in:
@@ -35,6 +35,9 @@
|
||||
;; ineg(ineg(x)) == x.
|
||||
(rule (simplify (ineg ty (ineg ty x))) (subsume x))
|
||||
|
||||
;; x-x == 0.
|
||||
(rule (simplify (isub (fits_in_64 (ty_int ty)) x x)) (subsume (iconst ty (imm64 0))))
|
||||
|
||||
;; x*1 == 1*x == x.
|
||||
(rule (simplify (imul ty
|
||||
x
|
||||
|
||||
Reference in New Issue
Block a user