Commit 9f56845f authored by Josh Bleecher Snyder's avatar Josh Bleecher Snyder

cmd/compile: stop shadowing bool type in rewrite rules

This disrupts code instrumentation tools like go-fuzz.

Change-Id: I524f31316975096ca5e3b1203a82e91ed1b6097e
Reviewed-on: https://go-review.googlesource.com/c/go/+/168801
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: default avatarCherry Zhang <cherryyz@google.com>
parent 99e22328
...@@ -361,8 +361,8 @@ ...@@ -361,8 +361,8 @@
(FCMPD (FMOVDconst [0]) x) -> (InvertFlags (FCMPD0 x)) (FCMPD (FMOVDconst [0]) x) -> (InvertFlags (FCMPD0 x))
// CSEL needs a flag-generating argument. Synthesize a CMPW if necessary. // CSEL needs a flag-generating argument. Synthesize a CMPW if necessary.
(CondSelect x y bool) && flagArg(bool) != nil -> (CSEL {bool.Op} x y flagArg(bool)) (CondSelect x y boolval) && flagArg(boolval) != nil -> (CSEL {boolval.Op} x y flagArg(boolval))
(CondSelect x y bool) && flagArg(bool) == nil -> (CSEL {OpARM64NotEqual} x y (CMPWconst [0] bool)) (CondSelect x y boolval) && flagArg(boolval) == nil -> (CSEL {OpARM64NotEqual} x y (CMPWconst [0] boolval))
(OffPtr [off] ptr:(SP)) -> (MOVDaddr [off] ptr) (OffPtr [off] ptr:(SP)) -> (MOVDaddr [off] ptr)
(OffPtr [off] ptr) -> (ADDconst [off] ptr) (OffPtr [off] ptr) -> (ADDconst [off] ptr)
...@@ -1647,14 +1647,14 @@ ...@@ -1647,14 +1647,14 @@
(CSEL0 {cc} _ flag) && ccARM64Eval(cc, flag) < 0 -> (MOVDconst [0]) (CSEL0 {cc} _ flag) && ccARM64Eval(cc, flag) < 0 -> (MOVDconst [0])
// absorb flags back into boolean CSEL // absorb flags back into boolean CSEL
(CSEL {cc} x y (CMPWconst [0] bool)) && cc.(Op) == OpARM64NotEqual && flagArg(bool) != nil -> (CSEL {cc} x y (CMPWconst [0] boolval)) && cc.(Op) == OpARM64NotEqual && flagArg(boolval) != nil ->
(CSEL {bool.Op} x y flagArg(bool)) (CSEL {boolval.Op} x y flagArg(boolval))
(CSEL {cc} x y (CMPWconst [0] bool)) && cc.(Op) == OpARM64Equal && flagArg(bool) != nil -> (CSEL {cc} x y (CMPWconst [0] boolval)) && cc.(Op) == OpARM64Equal && flagArg(boolval) != nil ->
(CSEL {arm64Negate(bool.Op)} x y flagArg(bool)) (CSEL {arm64Negate(boolval.Op)} x y flagArg(boolval))
(CSEL0 {cc} x (CMPWconst [0] bool)) && cc.(Op) == OpARM64NotEqual && flagArg(bool) != nil -> (CSEL0 {cc} x (CMPWconst [0] boolval)) && cc.(Op) == OpARM64NotEqual && flagArg(boolval) != nil ->
(CSEL0 {bool.Op} x flagArg(bool)) (CSEL0 {boolval.Op} x flagArg(boolval))
(CSEL0 {cc} x (CMPWconst [0] bool)) && cc.(Op) == OpARM64Equal && flagArg(bool) != nil -> (CSEL0 {cc} x (CMPWconst [0] boolval)) && cc.(Op) == OpARM64Equal && flagArg(boolval) != nil ->
(CSEL0 {arm64Negate(bool.Op)} x flagArg(bool)) (CSEL0 {arm64Negate(boolval.Op)} x flagArg(boolval))
// absorb shifts into ops // absorb shifts into ops
(NEG x:(SLLconst [c] y)) && clobberIfDead(x) -> (NEGshiftLL [c] y) (NEG x:(SLLconst [c] y)) && clobberIfDead(x) -> (NEGshiftLL [c] y)
......
...@@ -4557,9 +4557,9 @@ func rewriteValueARM64_OpARM64CSEL_0(v *Value) bool { ...@@ -4557,9 +4557,9 @@ func rewriteValueARM64_OpARM64CSEL_0(v *Value) bool {
v.AddArg(y) v.AddArg(y)
return true return true
} }
// match: (CSEL {cc} x y (CMPWconst [0] bool)) // match: (CSEL {cc} x y (CMPWconst [0] boolval))
// cond: cc.(Op) == OpARM64NotEqual && flagArg(bool) != nil // cond: cc.(Op) == OpARM64NotEqual && flagArg(boolval) != nil
// result: (CSEL {bool.Op} x y flagArg(bool)) // result: (CSEL {boolval.Op} x y flagArg(boolval))
for { for {
cc := v.Aux cc := v.Aux
_ = v.Args[2] _ = v.Args[2]
...@@ -4572,20 +4572,20 @@ func rewriteValueARM64_OpARM64CSEL_0(v *Value) bool { ...@@ -4572,20 +4572,20 @@ func rewriteValueARM64_OpARM64CSEL_0(v *Value) bool {
if v_2.AuxInt != 0 { if v_2.AuxInt != 0 {
break break
} }
bool := v_2.Args[0] boolval := v_2.Args[0]
if !(cc.(Op) == OpARM64NotEqual && flagArg(bool) != nil) { if !(cc.(Op) == OpARM64NotEqual && flagArg(boolval) != nil) {
break break
} }
v.reset(OpARM64CSEL) v.reset(OpARM64CSEL)
v.Aux = bool.Op v.Aux = boolval.Op
v.AddArg(x) v.AddArg(x)
v.AddArg(y) v.AddArg(y)
v.AddArg(flagArg(bool)) v.AddArg(flagArg(boolval))
return true return true
} }
// match: (CSEL {cc} x y (CMPWconst [0] bool)) // match: (CSEL {cc} x y (CMPWconst [0] boolval))
// cond: cc.(Op) == OpARM64Equal && flagArg(bool) != nil // cond: cc.(Op) == OpARM64Equal && flagArg(boolval) != nil
// result: (CSEL {arm64Negate(bool.Op)} x y flagArg(bool)) // result: (CSEL {arm64Negate(boolval.Op)} x y flagArg(boolval))
for { for {
cc := v.Aux cc := v.Aux
_ = v.Args[2] _ = v.Args[2]
...@@ -4598,15 +4598,15 @@ func rewriteValueARM64_OpARM64CSEL_0(v *Value) bool { ...@@ -4598,15 +4598,15 @@ func rewriteValueARM64_OpARM64CSEL_0(v *Value) bool {
if v_2.AuxInt != 0 { if v_2.AuxInt != 0 {
break break
} }
bool := v_2.Args[0] boolval := v_2.Args[0]
if !(cc.(Op) == OpARM64Equal && flagArg(bool) != nil) { if !(cc.(Op) == OpARM64Equal && flagArg(boolval) != nil) {
break break
} }
v.reset(OpARM64CSEL) v.reset(OpARM64CSEL)
v.Aux = arm64Negate(bool.Op) v.Aux = arm64Negate(boolval.Op)
v.AddArg(x) v.AddArg(x)
v.AddArg(y) v.AddArg(y)
v.AddArg(flagArg(bool)) v.AddArg(flagArg(boolval))
return true return true
} }
return false return false
...@@ -4658,9 +4658,9 @@ func rewriteValueARM64_OpARM64CSEL0_0(v *Value) bool { ...@@ -4658,9 +4658,9 @@ func rewriteValueARM64_OpARM64CSEL0_0(v *Value) bool {
v.AuxInt = 0 v.AuxInt = 0
return true return true
} }
// match: (CSEL0 {cc} x (CMPWconst [0] bool)) // match: (CSEL0 {cc} x (CMPWconst [0] boolval))
// cond: cc.(Op) == OpARM64NotEqual && flagArg(bool) != nil // cond: cc.(Op) == OpARM64NotEqual && flagArg(boolval) != nil
// result: (CSEL0 {bool.Op} x flagArg(bool)) // result: (CSEL0 {boolval.Op} x flagArg(boolval))
for { for {
cc := v.Aux cc := v.Aux
_ = v.Args[1] _ = v.Args[1]
...@@ -4672,19 +4672,19 @@ func rewriteValueARM64_OpARM64CSEL0_0(v *Value) bool { ...@@ -4672,19 +4672,19 @@ func rewriteValueARM64_OpARM64CSEL0_0(v *Value) bool {
if v_1.AuxInt != 0 { if v_1.AuxInt != 0 {
break break
} }
bool := v_1.Args[0] boolval := v_1.Args[0]
if !(cc.(Op) == OpARM64NotEqual && flagArg(bool) != nil) { if !(cc.(Op) == OpARM64NotEqual && flagArg(boolval) != nil) {
break break
} }
v.reset(OpARM64CSEL0) v.reset(OpARM64CSEL0)
v.Aux = bool.Op v.Aux = boolval.Op
v.AddArg(x) v.AddArg(x)
v.AddArg(flagArg(bool)) v.AddArg(flagArg(boolval))
return true return true
} }
// match: (CSEL0 {cc} x (CMPWconst [0] bool)) // match: (CSEL0 {cc} x (CMPWconst [0] boolval))
// cond: cc.(Op) == OpARM64Equal && flagArg(bool) != nil // cond: cc.(Op) == OpARM64Equal && flagArg(boolval) != nil
// result: (CSEL0 {arm64Negate(bool.Op)} x flagArg(bool)) // result: (CSEL0 {arm64Negate(boolval.Op)} x flagArg(boolval))
for { for {
cc := v.Aux cc := v.Aux
_ = v.Args[1] _ = v.Args[1]
...@@ -4696,14 +4696,14 @@ func rewriteValueARM64_OpARM64CSEL0_0(v *Value) bool { ...@@ -4696,14 +4696,14 @@ func rewriteValueARM64_OpARM64CSEL0_0(v *Value) bool {
if v_1.AuxInt != 0 { if v_1.AuxInt != 0 {
break break
} }
bool := v_1.Args[0] boolval := v_1.Args[0]
if !(cc.(Op) == OpARM64Equal && flagArg(bool) != nil) { if !(cc.(Op) == OpARM64Equal && flagArg(boolval) != nil) {
break break
} }
v.reset(OpARM64CSEL0) v.reset(OpARM64CSEL0)
v.Aux = arm64Negate(bool.Op) v.Aux = arm64Negate(boolval.Op)
v.AddArg(x) v.AddArg(x)
v.AddArg(flagArg(bool)) v.AddArg(flagArg(boolval))
return true return true
} }
return false return false
...@@ -32486,31 +32486,31 @@ func rewriteValueARM64_OpCom8_0(v *Value) bool { ...@@ -32486,31 +32486,31 @@ func rewriteValueARM64_OpCom8_0(v *Value) bool {
} }
func rewriteValueARM64_OpCondSelect_0(v *Value) bool { func rewriteValueARM64_OpCondSelect_0(v *Value) bool {
b := v.Block b := v.Block
// match: (CondSelect x y bool) // match: (CondSelect x y boolval)
// cond: flagArg(bool) != nil // cond: flagArg(boolval) != nil
// result: (CSEL {bool.Op} x y flagArg(bool)) // result: (CSEL {boolval.Op} x y flagArg(boolval))
for { for {
bool := v.Args[2] boolval := v.Args[2]
x := v.Args[0] x := v.Args[0]
y := v.Args[1] y := v.Args[1]
if !(flagArg(bool) != nil) { if !(flagArg(boolval) != nil) {
break break
} }
v.reset(OpARM64CSEL) v.reset(OpARM64CSEL)
v.Aux = bool.Op v.Aux = boolval.Op
v.AddArg(x) v.AddArg(x)
v.AddArg(y) v.AddArg(y)
v.AddArg(flagArg(bool)) v.AddArg(flagArg(boolval))
return true return true
} }
// match: (CondSelect x y bool) // match: (CondSelect x y boolval)
// cond: flagArg(bool) == nil // cond: flagArg(boolval) == nil
// result: (CSEL {OpARM64NotEqual} x y (CMPWconst [0] bool)) // result: (CSEL {OpARM64NotEqual} x y (CMPWconst [0] boolval))
for { for {
bool := v.Args[2] boolval := v.Args[2]
x := v.Args[0] x := v.Args[0]
y := v.Args[1] y := v.Args[1]
if !(flagArg(bool) == nil) { if !(flagArg(boolval) == nil) {
break break
} }
v.reset(OpARM64CSEL) v.reset(OpARM64CSEL)
...@@ -32519,7 +32519,7 @@ func rewriteValueARM64_OpCondSelect_0(v *Value) bool { ...@@ -32519,7 +32519,7 @@ func rewriteValueARM64_OpCondSelect_0(v *Value) bool {
v.AddArg(y) v.AddArg(y)
v0 := b.NewValue0(v.Pos, OpARM64CMPWconst, types.TypeFlags) v0 := b.NewValue0(v.Pos, OpARM64CMPWconst, types.TypeFlags)
v0.AuxInt = 0 v0.AuxInt = 0
v0.AddArg(bool) v0.AddArg(boolval)
v.AddArg(v0) v.AddArg(v0)
return true return true
} }
......
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