Commit abda0a6a authored by Josh Bleecher Snyder's avatar Josh Bleecher Snyder

cmd/compile: remove redundant rules

EqPtr and NeqPtr are marked as commutative,
so the transformations for rules are already
generated by the preceding two lines.

Change-Id: Ibecba5c8e54d9df00c84e1dae7e5d8cb53eeff43
Reviewed-on: https://go-review.googlesource.com/c/go/+/180939
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: default avatarKeith Randall <khr@golang.org>
parent 97bc039c
...@@ -1916,8 +1916,6 @@ ...@@ -1916,8 +1916,6 @@
(EqPtr (LocalAddr _ _) (Addr _)) -> (ConstBool [0]) (EqPtr (LocalAddr _ _) (Addr _)) -> (ConstBool [0])
(NeqPtr (LocalAddr _ _) (Addr _)) -> (ConstBool [1]) (NeqPtr (LocalAddr _ _) (Addr _)) -> (ConstBool [1])
(EqPtr (Addr _) (LocalAddr _ _)) -> (ConstBool [0])
(NeqPtr (Addr _) (LocalAddr _ _)) -> (ConstBool [1])
// Simplify address comparisons. // Simplify address comparisons.
(EqPtr (AddPtr p1 o1) p2) && isSamePtr(p1, p2) -> (Not (IsNonNil o1)) (EqPtr (AddPtr p1 o1) p2) && isSamePtr(p1, p2) -> (Not (IsNonNil o1))
......
...@@ -27319,42 +27319,6 @@ func rewriteValuegeneric_OpEqPtr_10(v *Value) bool { ...@@ -27319,42 +27319,6 @@ func rewriteValuegeneric_OpEqPtr_10(v *Value) bool {
v.AuxInt = 0 v.AuxInt = 0
return true return true
} }
// match: (EqPtr (Addr _) (LocalAddr _ _))
// cond:
// result: (ConstBool [0])
for {
_ = v.Args[1]
v_0 := v.Args[0]
if v_0.Op != OpAddr {
break
}
v_1 := v.Args[1]
if v_1.Op != OpLocalAddr {
break
}
_ = v_1.Args[1]
v.reset(OpConstBool)
v.AuxInt = 0
return true
}
// match: (EqPtr (LocalAddr _ _) (Addr _))
// cond:
// result: (ConstBool [0])
for {
_ = v.Args[1]
v_0 := v.Args[0]
if v_0.Op != OpLocalAddr {
break
}
_ = v_0.Args[1]
v_1 := v.Args[1]
if v_1.Op != OpAddr {
break
}
v.reset(OpConstBool)
v.AuxInt = 0
return true
}
// match: (EqPtr (AddPtr p1 o1) p2) // match: (EqPtr (AddPtr p1 o1) p2)
// cond: isSamePtr(p1, p2) // cond: isSamePtr(p1, p2)
// result: (Not (IsNonNil o1)) // result: (Not (IsNonNil o1))
...@@ -27414,11 +27378,6 @@ func rewriteValuegeneric_OpEqPtr_10(v *Value) bool { ...@@ -27414,11 +27378,6 @@ func rewriteValuegeneric_OpEqPtr_10(v *Value) bool {
v.AddArg(v0) v.AddArg(v0)
return true return true
} }
return false
}
func rewriteValuegeneric_OpEqPtr_20(v *Value) bool {
b := v.Block
typ := &b.Func.Config.Types
// match: (EqPtr p (Const32 [0])) // match: (EqPtr p (Const32 [0]))
// cond: // cond:
// result: (Not (IsNonNil p)) // result: (Not (IsNonNil p))
...@@ -27456,6 +27415,11 @@ func rewriteValuegeneric_OpEqPtr_20(v *Value) bool { ...@@ -27456,6 +27415,11 @@ func rewriteValuegeneric_OpEqPtr_20(v *Value) bool {
v.AddArg(v0) v.AddArg(v0)
return true return true
} }
return false
}
func rewriteValuegeneric_OpEqPtr_20(v *Value) bool {
b := v.Block
typ := &b.Func.Config.Types
// match: (EqPtr p (Const64 [0])) // match: (EqPtr p (Const64 [0]))
// cond: // cond:
// result: (Not (IsNonNil p)) // result: (Not (IsNonNil p))
...@@ -38662,42 +38626,6 @@ func rewriteValuegeneric_OpNeqPtr_10(v *Value) bool { ...@@ -38662,42 +38626,6 @@ func rewriteValuegeneric_OpNeqPtr_10(v *Value) bool {
v.AuxInt = 1 v.AuxInt = 1
return true return true
} }
// match: (NeqPtr (Addr _) (LocalAddr _ _))
// cond:
// result: (ConstBool [1])
for {
_ = v.Args[1]
v_0 := v.Args[0]
if v_0.Op != OpAddr {
break
}
v_1 := v.Args[1]
if v_1.Op != OpLocalAddr {
break
}
_ = v_1.Args[1]
v.reset(OpConstBool)
v.AuxInt = 1
return true
}
// match: (NeqPtr (LocalAddr _ _) (Addr _))
// cond:
// result: (ConstBool [1])
for {
_ = v.Args[1]
v_0 := v.Args[0]
if v_0.Op != OpLocalAddr {
break
}
_ = v_0.Args[1]
v_1 := v.Args[1]
if v_1.Op != OpAddr {
break
}
v.reset(OpConstBool)
v.AuxInt = 1
return true
}
// match: (NeqPtr (AddPtr p1 o1) p2) // match: (NeqPtr (AddPtr p1 o1) p2)
// cond: isSamePtr(p1, p2) // cond: isSamePtr(p1, p2)
// result: (IsNonNil o1) // result: (IsNonNil o1)
...@@ -38751,9 +38679,6 @@ func rewriteValuegeneric_OpNeqPtr_10(v *Value) bool { ...@@ -38751,9 +38679,6 @@ func rewriteValuegeneric_OpNeqPtr_10(v *Value) bool {
v.AddArg(p) v.AddArg(p)
return true return true
} }
return false
}
func rewriteValuegeneric_OpNeqPtr_20(v *Value) bool {
// match: (NeqPtr p (Const32 [0])) // match: (NeqPtr p (Const32 [0]))
// cond: // cond:
// result: (IsNonNil p) // result: (IsNonNil p)
...@@ -38787,6 +38712,9 @@ func rewriteValuegeneric_OpNeqPtr_20(v *Value) bool { ...@@ -38787,6 +38712,9 @@ func rewriteValuegeneric_OpNeqPtr_20(v *Value) bool {
v.AddArg(p) v.AddArg(p)
return true return true
} }
return false
}
func rewriteValuegeneric_OpNeqPtr_20(v *Value) bool {
// match: (NeqPtr p (Const64 [0])) // match: (NeqPtr p (Const64 [0]))
// cond: // cond:
// result: (IsNonNil p) // result: (IsNonNil p)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment