Commit 6ed10382 authored by Josh Bleecher Snyder's avatar Josh Bleecher Snyder

cmd/compile: soup up isSamePtr

This increases the number of matches in make.bash
from 853 to 984.

Change-Id: I12697697a50ecd86d49698200144a4c80dd3e5a4
Reviewed-on: https://go-review.googlesource.com/20274Reviewed-by: default avatarTodd Neal <todd@tneal.org>
parent ff71ed86
......@@ -207,11 +207,20 @@ func isSamePtr(p1, p2 *Value) bool {
if p1 == p2 {
return true
}
// Aux isn't used in OffPtr, and AuxInt isn't currently used in
// Addr, but this still works as the values will be null/0
return (p1.Op == OpOffPtr || p1.Op == OpAddr) && p1.Op == p2.Op &&
p1.Aux == p2.Aux && p1.AuxInt == p2.AuxInt &&
p1.Args[0] == p2.Args[0]
if p1.Op != p2.Op {
return false
}
switch p1.Op {
case OpOffPtr:
return p1.AuxInt == p2.AuxInt && isSamePtr(p1.Args[0], p2.Args[0])
case OpAddr:
// OpAddr's 0th arg is either OpSP or OpSB, which means that it is uniquely identified by its Op.
// Checking for value equality only works after [z]cse has run.
return p1.Aux == p2.Aux && p1.Args[0].Op == p2.Args[0].Op
case OpAddPtr:
return p1.Args[1] == p2.Args[1] && isSamePtr(p1.Args[0], p2.Args[0])
}
return false
}
// DUFFZERO consists of repeated blocks of 4 MOVUPSs + ADD,
......
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