mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/compile: rewrite cmov(x, x, cond) into x
I don't think branchelim will intentionally generate theses. But at the time where branchelim is generating them they might different, and through opt process they become the same value. Change-Id: I4a19f1db14c08057b7e782a098f4c18ca36ab7fe Reviewed-on: https://go-review.googlesource.com/c/go/+/690519 Auto-Submit: Keith Randall <khr@golang.org> Reviewed-by: Mark Freeman <mark@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Keith Randall <khr@golang.org>
This commit is contained in:
parent
10c5cf68d4
commit
94645d2413
2 changed files with 11 additions and 0 deletions
|
|
@ -5722,6 +5722,16 @@ func rewriteValuegeneric_OpCondSelect(v *Value) bool {
|
|||
v.copyOf(y)
|
||||
return true
|
||||
}
|
||||
// match: (CondSelect x x _)
|
||||
// result: x
|
||||
for {
|
||||
x := v_0
|
||||
if x != v_1 {
|
||||
break
|
||||
}
|
||||
v.copyOf(x)
|
||||
return true
|
||||
}
|
||||
// match: (CondSelect (Add8 <t> x (Const8 [1])) x bool)
|
||||
// cond: config.arch != "arm64"
|
||||
// result: (Add8 x (CvtBoolToUint8 <t> bool))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue