remove redundant x/c pattern [run_process_replay] (#6082)

there's no div and 1/c is const folded
This commit is contained in:
chenyu
2024-08-14 16:57:39 -04:00
committed by GitHub
parent a61cb1ff7c
commit 95aa6d8ccd

View File

@@ -258,7 +258,6 @@ constant_folder = PatternMatcher([
(NOp.var('x') // 1, lambda x: x), # x//1 -> x
(NOp.var('x') // -1, lambda x: -x), # x//-1 -> -x
(NOp.var('x') / NOp.var('x'), lambda x: x.const(1)), # x/x -> 1
(NOp.var('x') / NOp.cvar('c'), lambda x,c: x*exec_alu(UnaryOps.RECIP, c.dtype, [c.arg])), # x/c -> x*(1/c)
# ** zero folding **
# x*0 -> 0 or 0*x -> 0
# if x is nan or inf it should render the nan value.