summaryrefslogtreecommitdiffstats
path: root/src/cmd/compile/internal/compare/compare.go
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-08 04:11:07 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-08 04:11:07 +0000
commit17cd1672e40d83687d20266b4f71a0dce064f0e4 (patch)
tree1e10132d08269d9fba82dbba3c5b991e070d3446 /src/cmd/compile/internal/compare/compare.go
parentReleasing progress-linux version 1.22.3-1~progress7.99u1. (diff)
downloadgolang-1.22-17cd1672e40d83687d20266b4f71a0dce064f0e4.tar.xz
golang-1.22-17cd1672e40d83687d20266b4f71a0dce064f0e4.zip
Merging upstream version 1.22.4.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/cmd/compile/internal/compare/compare.go')
-rw-r--r--src/cmd/compile/internal/compare/compare.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/cmd/compile/internal/compare/compare.go b/src/cmd/compile/internal/compare/compare.go
index e165cd6..cb2f84e 100644
--- a/src/cmd/compile/internal/compare/compare.go
+++ b/src/cmd/compile/internal/compare/compare.go
@@ -148,7 +148,7 @@ func calculateCostForType(t *types.Type) int64 {
return EqStructCost(t)
case types.TSLICE:
// Slices are not comparable.
- base.Fatalf("eqStructFieldCost: unexpected slice type")
+ base.Fatalf("calculateCostForType: unexpected slice type")
case types.TARRAY:
elemCost := calculateCostForType(t.Elem())
cost = t.NumElem() * elemCost
@@ -371,6 +371,11 @@ func eqmem(p, q ir.Node, field int, size int64) ir.Node {
}
func eqmemfunc(size int64, t *types.Type) (fn *ir.Name, needsize bool) {
+ if !base.Ctxt.Arch.CanMergeLoads && t.Alignment() < int64(base.Ctxt.Arch.Alignment) && t.Alignment() < t.Size() {
+ // We can't use larger comparisons if the value might not be aligned
+ // enough for the larger comparison. See issues 46283 and 67160.
+ size = 0
+ }
switch size {
case 1, 2, 4, 8, 16:
buf := fmt.Sprintf("memequal%d", int(size)*8)