diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-08 04:06:25 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-08 04:09:11 +0000 |
commit | 78b12c962613340f18d456e8eaef0aa217e60ce6 (patch) | |
tree | 78cf47375034c8fec16617a8b81d04ba95205ffe /src/cmd/compile | |
parent | Adding upstream version 1.21.10. (diff) | |
download | golang-1.21-upstream.tar.xz golang-1.21-upstream.zip |
Adding upstream version 1.21.11.upstream/1.21.11upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/cmd/compile')
-rw-r--r-- | src/cmd/compile/internal/compare/compare.go | 7 |
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 1674065..e848e1c 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 @@ -374,6 +374,11 @@ func eqmem(p ir.Node, q ir.Node, field *types.Sym, 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 { default: fn = typecheck.LookupRuntime("memequal") |