aboutsummaryrefslogtreecommitdiff
path: root/test
AgeCommit message (Collapse)Author
41 hourscmd/compile: handle min integer step in loopCuong Manh Le
Since negating min int will overflows back to itself, causing a panic inside subWillUnderflow check. Fixes #78641 Change-Id: Ibbf2fa3228b9890a1a76ac6f4ff504b7e125b29f Reviewed-on: https://go-review.googlesource.com/c/go/+/766260 Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com> LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: David Chase <drchase@google.com> Reviewed-by: Jorropo <jorropo.pgm@gmail.com> Reviewed-by: Keith Randall <khr@google.com>
2 dayscmd/compile: add boolean absorption laws to SSA rewrite rulesTimo Friedl
The SSA generic rewrite rules implement DeMorgan's laws but are missing the closely related boolean absorption laws: x & (x | y) == x x | (x & y) == x These are fundamental boolean algebra identities (see https://en.wikipedia.org/wiki/Absorption_law) that hold for all bit patterns, all widths, signed and unsigned. Both GCC and LLVM recognize and optimize these patterns at -O2. Add two generic rules covering all four widths (8, 16, 32, 64). Commutativity of AND/OR is handled automatically by the rule engine, so all argument orderings are matched. The rules eliminate two redundant ALU instructions per occurrence and fire on real code (defer bit-manipulation patterns in runtime, testing, go/parser, and third-party packages). Fixes #78632 Change-Id: Ib59e839081302ad1635e823309d8aec768c25dcf GitHub-Last-Rev: 23f8296ece08c77fcaeeaf59c2c2d8ce23d1202c GitHub-Pull-Request: golang/go#78634 Reviewed-on: https://go-review.googlesource.com/c/go/+/765580 Reviewed-by: Keith Randall <khr@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: David Chase <drchase@google.com> Reviewed-by: Keith Randall <khr@golang.org> Auto-Submit: Keith Randall <khr@golang.org> Reviewed-by: Jorropo <jorropo.pgm@gmail.com>
5 dayscmd/compile/internal/noder: revert to UIR V3Mark Freeman
Upgrading to V4 early doesn't seem to make much sense while we refine things. Any change to encoding would require another version gate and propagation; this gets tedious fast. Instead, let's keep on V3 and test locally with V4. We can commit skipped tests as we refine and then turn them all on *with* the bump up to V4. Change-Id: I571715e5da75095612f68b224c82e6d22ad3ab25 Reviewed-on: https://go-review.googlesource.com/c/go/+/765444 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Alan Donovan <adonovan@google.com> Auto-Submit: Mark Freeman <markfreeman@google.com>
6 daystest: more tests for generic methodsMark Freeman
These tests verify that generic method type arguments are ordered correctly for a variety of expression forms and dictionary kinds. Change-Id: I067206d1e97d5350d6fcc3983f5a6ef24a782214 Reviewed-on: https://go-review.googlesource.com/c/go/+/764200 Reviewed-by: Robert Griesemer <gri@google.com> Auto-Submit: Mark Freeman <markfreeman@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
6 dayscmd/internal/tesdir: fix Test/codegen/switch on loong64qmuntal
loong64 uses ALSLV the compute the lookup index. Fixes #78575 Change-Id: Ied90a4f811cc19ffec4d304333546d1fa430ccc0 Reviewed-on: https://go-review.googlesource.com/c/go/+/764180 Reviewed-by: abner chenc <chenguoqi@loongson.cn> Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: David Chase <drchase@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Keith Randall <khr@google.com>
6 dayscmd/compile: run CondSelect into math rules on all archesJorropo
Fixes #78558 I've also added tests to make sure PPC still generate ISEL when the constant isn't 1. This is to make sure we aren't generating a sequence that wouldn't work right now. But it does not mean we couldn't try to optimize other constants on PPC64 if a fast sequence exists; for example like arm64's inline register shifts. Change-Id: Ic241d593149b7a11533948f5d4c52db357cc134f Reviewed-on: https://go-review.googlesource.com/c/go/+/763340 Reviewed-by: Keith Randall <khr@google.com> Auto-Submit: Jorropo <jorropo.pgm@gmail.com> Reviewed-by: David Chase <drchase@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Jayanth Krishnamurthy <jayanth.krishnamurthy@ibm.com> Reviewed-by: Paul Murphy <paumurph@redhat.com>
7 dayscmd/compile: improve stp merging for non-sequent casesMelnikov Denis
Original algorithm merges stores with the first mergeable store in the chain, but it misses some cases. Additionally, creating list of STs, which store data to adjacent memory cells allows merging them according to the direction of increase of their addresses. I have already tried another algorithm in CL 698097, but it was reverted. This algorithm works differently and fixes bug, generated by variant from another CL. Fixes #71987, #75365 There are the results of sweet benchmarks │ base.stat │ opt.stat │ │ sec/op │ sec/op vs base │ ESBuildThreeJS-4 1.088 ± 2% 1.086 ± 1% ~ (p=1.000 n=10) ESBuildRomeTS-4 263.0m ± 2% 260.8m ± 1% ~ (p=0.105 n=10) EtcdPut-4 73.08m ± 1% 73.16m ± 1% ~ (p=0.971 n=10) EtcdSTM-4 414.9m ± 1% 415.4m ± 1% ~ (p=0.393 n=10) GoBuildKubelet-4 203.3 ± 0% 203.5 ± 0% ~ (p=0.393 n=10) GoBuildKubeletLink-4 19.06 ± 1% 19.05 ± 0% ~ (p=0.280 n=10) GoBuildIstioctl-4 156.6 ± 0% 156.6 ± 0% ~ (p=0.796 n=10) GoBuildIstioctlLink-4 14.16 ± 1% 14.18 ± 1% ~ (p=0.853 n=10) GoBuildFrontend-4 56.45 ± 1% 56.57 ± 0% ~ (p=0.579 n=10) GoBuildFrontendLink-4 3.635 ± 1% 3.646 ± 0% ~ (p=0.436 n=10) GoBuildTsgo-4 103.0 ± 1% 103.4 ± 1% ~ (p=0.529 n=10) GoBuildTsgoLink-4 1.865 ± 1% 1.860 ± 1% ~ (p=0.684 n=10) GopherLuaKNucleotide-4 33.55 ± 0% 33.58 ± 0% ~ (p=0.075 n=10) MarkdownRenderXHTML-4 281.0m ± 0% 280.3m ± 0% -0.23% (p=0.019 n=10) Tile38QueryLoad-4 970.0µ ± 1% 969.3µ ± 0% ~ (p=0.436 n=10) geomean 3.128 3.128 -0.01% Change-Id: Ia548b43601b1bdb1c1723d300a4b8b907ab0c040 Reviewed-on: https://go-review.googlesource.com/c/go/+/760100 Reviewed-by: Mark Freeman <markfreeman@google.com> Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Keith Randall <khr@golang.org>
7 dayscmd/compile: fix loopbce overflow check logicJunyang Shao
addWillOverflow and subWillOverflow has an implicit assumption that y is positive, using it outside of addU and subU is really incorrect. This CL fixes those incorrect usage to use the correct logic in place. Thanks to Jakub Ciolek for reporting this issue. Fixes #78333 Fixes CVE-2026-27143 Change-Id: I263e8e7ac227e2a68109eb7bbd45f66569ed22ec Reviewed-on: https://go-internal-review.googlesource.com/c/go/+/3700 Reviewed-by: Damien Neil <dneil@google.com> Reviewed-by: Neal Patel <nealpatel@google.com> Reviewed-on: https://go-review.googlesource.com/c/go/+/763765 Reviewed-by: Jakub Ciolek <jakub@ciolek.dev> Reviewed-by: Russ Cox <rsc@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: David Chase <drchase@google.com>
7 dayscmd/compile: support all constant return types in switch lookup tablesqmuntal
Lookup tables for switch statements can be generalized to also support bools, strings, floats, and complex numbers. Change-Id: Ic3ece41fe2009050fbf08ba6f06ea8a567407974 Reviewed-on: https://go-review.googlesource.com/c/go/+/763320 Reviewed-by: David Chase <drchase@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@google.com>
8 daystest: add a simple test using generic methodsMark Freeman
Change-Id: Ia22aff4d7b6d6f9250c3915fba947fcc3bd800d5 Reviewed-on: https://go-review.googlesource.com/c/go/+/763180 Reviewed-by: Robert Griesemer <gri@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
8 dayscmd/compile: report error instead of ICE for oversized map elementgulmix
When a map element or key type is 2GB or larger, the compiler crashed with "internal compiler error: map elem too big" in reflectdata.ZeroAddr. Add a size check in types.CalcSize for TMAP, similar to the existing check for channel element types, so that oversized map elements are reported as a normal error before reaching ZeroAddr. Fixes #78355 Change-Id: I281a5f0ec7dda6dac084787859156d4409dc860c Reviewed-on: https://go-review.googlesource.com/c/go/+/760600 Auto-Submit: Keith Randall <khr@golang.org> Reviewed-by: Robert Griesemer <gri@google.com> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Keith Randall <khr@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
8 dayscmd/compile: optimize CondSelect to math on arm64 with inline register shiftsJorropo
Change-Id: I27696b1a5fa0593d9f36743efa3559a36d23ec4b Reviewed-on: https://go-review.googlesource.com/c/go/+/760844 Reviewed-by: David Chase <drchase@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Keith Randall <khr@golang.org> Auto-Submit: Jorropo <jorropo.pgm@gmail.com> Reviewed-by: Keith Randall <khr@google.com>
8 dayscmd/compile: improve Mul to Left Shift rulesJorropo
- fix a bug where it wouldn't recognize 1<<63 as a power of two - remove the IsSigned check; there is no such thing as a signed Mul If the rule works for signed numbers it works for unsigned ones too. Even if the intermediary steps makes no sense, it ends up wrapping the right way around in the end. Change-Id: I86182762aec5eff784e2d9bc49ee028825fb9ea0 Reviewed-on: https://go-review.googlesource.com/c/go/+/760843 Reviewed-by: Keith Randall <khr@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Keith Randall <khr@google.com> Auto-Submit: Jorropo <jorropo.pgm@gmail.com> Reviewed-by: Junyang Shao <shaojunyang@google.com>
9 dayscmd/compile: extend condselect into math code to handle other constants than 1Jorropo
On amd64 along: if b { x += 1 } => x += b We can also implement constants 2 4 and 8: if b { x += 2 } => x += b * 2 This compiles to a displacement LEA. Change-Id: Ib00fcc5059acb0ebb346e056c4a656f164cc63df Reviewed-on: https://go-review.googlesource.com/c/go/+/760841 Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Keith Randall <khr@golang.org> Auto-Submit: Jorropo <jorropo.pgm@gmail.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: David Chase <drchase@google.com>
9 dayscmd/compile: improve uint8/uint16 logical immediates on PPC64Jayanth Krishnamurthy jayanth.krishnamurthy@ibm.com
Logical ops on uint8/uint16 (AND/OR/XOR) with constants sometimes materialized the mask via MOVD (often as a negative immediate), even when the value fit in the UI-immediate range. This prevented the backend from selecting andi. / ori / xori forms. This CL makes: UI-immediate truncation is performed only at the use-site of logical-immediate ops, and only when the constant does not fit in the 8- or 16-bit unsigned domain (m != uint8(m) / m != uint16(m)). This avoids negative-mask materialization and enables correct emission of UI-form logical instructions. Arithmetic SI-immediate instructions (addi, subfic, etc.) and other use-patterns are unchanged. Codegen tests are added to ensure the expected andi./ori/xori patterns appear and that MOVD is not emitted for valid 8/16-bit masks. Change-Id: I9fcdf4498c4e984c7587814fb9019a75865c4a0d Cq-Include-Trybots: luci.golang.try:gotip-linux-ppc64_power10,gotip-linux-ppc64_power8,gotip-linux-ppc64le_power8,gotip-linux-ppc64le_power9,gotip-linux-ppc64le_power10 Reviewed-on: https://go-review.googlesource.com/c/go/+/704015 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Paul Murphy <paumurph@redhat.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Mark Freeman <markfreeman@google.com>
11 dayscmd/compile: optimize switch statements using lookup tablesqmuntal
Switch statement containing integer constant cases and case bodies just returning a constant should be optimizable to a simpler and faster table lookup instead of a jump table. That is, a switch like this: switch x { case 0: return 10 case 1: return 20 case 2: return 30 case 3: return 40 default: return -1 } Could be optimized to this: var table = [4]int{10, 20, 30, 40} if uint(x) < 4 { return table[x] } return -1 The resulting code is smaller and faster, especially on platforms where jump tables are not supported. goos: windows goarch: arm64 pkg: cmd/compile/internal/test │ .\old.txt │ .\new.txt │ │ sec/op │ sec/op vs base │ SwitchLookup8Predictable-12 2.708n ± 6% 2.249n ± 5% -16.97% (p=0.000 n=10) SwitchLookup8Unpredictable-12 8.758n ± 7% 3.272n ± 4% -62.65% (p=0.000 n=10) SwitchLookup32Predictable-12 2.672n ± 5% 2.373n ± 6% -11.21% (p=0.000 n=10) SwitchLookup32Unpredictable-12 9.372n ± 7% 3.385n ± 6% -63.89% (p=0.000 n=10) geomean 4.937n 2.772n -43.84% Fixes #78203 Change-Id: I74fa3d77ef618412951b2e5c3cb6ebc760ce4ff1 Reviewed-on: https://go-review.googlesource.com/c/go/+/756340 Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Junyang Shao <shaojunyang@google.com> Reviewed-by: Keith Randall <khr@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
12 dayscmd/compile: extend all the cmov into math generic rules with their contraryJorropo
If the bool comes from a local operation this is foldable into the comparison. if a == b { } else { x++ } becomes: x += !(a == b) becomes: x += a != b If the bool is passed in or loaded rather than being locally computed this adds an extra XOR ^1 to invert it. But at worst it should make the math equal to the compute + CMP + CMOV which is a tie on modern CPUs which can execute CMOV on all int ALUs and a win on the cheaper or older ones which can't. Change-Id: Idd2566c7a3826ec432ebfbba7b3898aa0db4b812 Reviewed-on: https://go-review.googlesource.com/c/go/+/760922 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Keith Randall <khr@google.com> Auto-Submit: Jorropo <jorropo.pgm@gmail.com> Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Junyang Shao <shaojunyang@google.com>
14 daysgo/types, types2: in range-over-func, the yield function cannot be variadicRobert Griesemer
Fixes #78483. For #78314. Change-Id: If83983c0bf79840aa02dc0d2fa8945f5e8b4e969 Reviewed-on: https://go-review.googlesource.com/c/go/+/761682 Auto-Submit: Robert Griesemer <gri@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Jakub Ciolek <jakub@ciolek.dev> Reviewed-by: Robert Griesemer <gri@google.com> Reviewed-by: Mark Freeman <markfreeman@google.com>
2026-03-31test/codegen: remove unneeded commasKeith Randall
After CL 760780, commas aren't allowed. But some CLs that were already in flight don't know that. Change-Id: I31f586c87def4a9746dc2c055923fce8bad6647e Reviewed-on: https://go-review.googlesource.com/c/go/+/761620 Auto-Submit: Keith Randall <khr@golang.org> Reviewed-by: Junyang Shao <shaojunyang@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Keith Randall <khr@google.com>
2026-03-31test/codegen: fix some unbalanced quotesKeith Randall
Change-Id: I081da8c79f0264118e079af21ff58c511ae37e6c Reviewed-on: https://go-review.googlesource.com/c/go/+/760682 Reviewed-by: Junyang Shao <shaojunyang@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Joel Sing <joel@sing.id.au> Reviewed-by: Keith Randall <khr@google.com> Auto-Submit: Keith Randall <khr@google.com>
2026-03-31test/codegen: replace commas with spaces between regexpsKeith Randall
Change-Id: Ia7a955833d761e08c1b8081fb29a2e6317de004c Reviewed-on: https://go-review.googlesource.com/c/go/+/760681 Auto-Submit: Keith Randall <khr@google.com> Reviewed-by: Junyang Shao <shaojunyang@google.com> Reviewed-by: Paul Murphy <paumurph@redhat.com> Reviewed-by: Keith Randall <khr@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-03-31test/codegen: get rid of \sKeith Randall
Replace \s with a space in backtick-quoted strings Replace \\s with a space in double-quoted strings Change-Id: I0c8b249bb12c2c8ca69e683e4bc6f27544fd6094 Reviewed-on: https://go-review.googlesource.com/c/go/+/760680 Auto-Submit: Keith Randall <khr@google.com> Reviewed-by: Junyang Shao <shaojunyang@google.com> Reviewed-by: Paul Murphy <paumurph@redhat.com> Reviewed-by: Keith Randall <khr@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-03-31test/codegen: fix broken syntaxKeith Randall
A bunch of tests had broken yet undetected syntax errors in their assembly output regexps. Things like mismatched quotes, using ^ instead of - for negation, etc. In addition, since CL 716060 using commas as separators between regexps doesn't work, and ends up just silently dropping every regexp after the comma. Fix all these things, and add a test to make sure that we're not silently dropping regexps on the floor. After this CL I will do some cleanup to align with CL 716060, like replacing commas and \s with spaces (which was the point of that CL, but wasn't consistently rewritten everywhere). Change-Id: I54f226120a311ead0c6c62eaf5d152ceed106034 Reviewed-on: https://go-review.googlesource.com/c/go/+/760521 Reviewed-by: Junyang Shao <shaojunyang@google.com> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Paul Murphy <paumurph@redhat.com> Auto-Submit: Keith Randall <khr@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-03-31cmd/compile: fix wrong label loop during rangefunc rewriteCuong Manh Le
During the rangefunc rewrite, the compiler must correctly identify the target of branch statements. When a label is defined within a nested scope - such as inside a function literal or a closure - it can shadow a label with the same name in the outer scope. If the rewrite logic does not account for this shadowing, it may incorrectly associate a branch with a nested label rather than the intended loop label. Since the typechecker already guarantees that labels are unique within their respective scopes, any duplicate label name encountered must belong to a nested scope. These should be skipped to ensure branch computing correctly targets the current range-loop scope. Fixes #78408 Change-Id: I4dce8a4d956f41b3a717a509f8c3f7478720be9f Reviewed-on: https://go-review.googlesource.com/c/go/+/761420 Reviewed-by: Keith Randall <khr@golang.org> Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Jakub Ciolek <jakub@ciolek.dev> Reviewed-by: Junyang Shao <shaojunyang@google.com> Reviewed-by: Keith Randall <khr@google.com>
2026-03-31cmd/compile: ensure map/slice clearing expressions are walkedCuong Manh Le
The order pass ensures that initialization operations for clear(expr) are scheduled. However, if 'expr' is a conversion that the walk pass subsequently optimizes away or transforms, the resulting nodes can be left in an un-walked state. These un-walked nodes reach the SSA backend, which does not expect high-level IR, resulting in an ICE. This change ensures the expression is always walked during the transformation of the 'clear' builtin. Fixes #78410 Change-Id: I1997a28af020f39b2d325a58429eff9495048b1f Reviewed-on: https://go-review.googlesource.com/c/go/+/760981 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Junyang Shao <shaojunyang@google.com> Reviewed-by: David Chase <drchase@google.com> Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
2026-03-31cmd/compile: convert some condmoves in XORJorropo
Similar to CL 685676 but for XOR. Change-Id: Ib5ffd4c13348f176a808b3218fdbbafc2c42794f Reviewed-on: https://go-review.googlesource.com/c/go/+/760921 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Junyang Shao <shaojunyang@google.com> Auto-Submit: Jorropo <jorropo.pgm@gmail.com> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Keith Randall <khr@golang.org>
2026-03-31cmd/compile: convert some condmoves in ORJorropo
Similar to CL 685676 but for OR. Change-Id: I0ddfd457ed9e8888462306138a251ac48ad42084 Reviewed-on: https://go-review.googlesource.com/c/go/+/760920 Auto-Submit: Jorropo <jorropo.pgm@gmail.com> 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> Reviewed-by: Junyang Shao <shaojunyang@google.com>
2026-03-30simd/archsimd: mark pa* unsafe helpers as nocheckptrCuong Manh Le
Despite the cast from smaller to bigger slice, the elements after the input slice length are not actually read. Thus they should have nocheckptr annotation to make checkptr happy. Fixes #78413 Change-Id: I3e27eab8a69b37bb11632b130a87e6625e06e8ac Reviewed-on: https://go-review.googlesource.com/c/go/+/761120 Reviewed-by: Cherry Mui <cherryyz@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Junyang Shao <shaojunyang@google.com> Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
2026-03-30cmd/compile/internal/devirtualize: use pointer identity for type comparisonMateusz Poliwczak
Fixes #78404 Change-Id: I6adc1fb42ad6a3acce21333c6819d0796a6a6964 Reviewed-on: https://go-review.googlesource.com/c/go/+/760161 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Keith Randall <khr@golang.org>
2026-03-27test/codegen: check mips64 sqrt/abs code only for hardfloatKeith Randall
Softfloat doesn't use the hardware instructions. Followon to CL 739520 + CL 757300 Change-Id: Ic271cd5567c62933d2d0c01d8834f9bf07e31061 Reviewed-on: https://go-review.googlesource.com/c/go/+/760520 Auto-Submit: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Julian Zhu <jz531210@gmail.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2026-03-27test/codegen: remove noop Ands from test casesJorropo
Theses test cases search for an AND that gets optimized away after CL 760307. Should help to fix riscv64 (coudn't check as builders don't appear on https://build.golang.org/ ) and loong64 CI on master. Change-Id: I57e4e5ab7d3003f239355137472585e46493d8dc Reviewed-on: https://go-review.googlesource.com/c/go/+/760640 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Keith Randall <khr@golang.org> Auto-Submit: Jorropo <jorropo.pgm@gmail.com>
2026-03-27test/codegen: fix ppc64x rldicl bit testPaul Murphy
The prove pass removes superfluous bit masking. This was meant to test the edge cases of the ppc64 folding rules which are exactly the cases the prove pass now removes. Fixes #78403 Change-Id: I45eeac58e01b42e19b8a06bb0d7af96c616ccbff Reviewed-on: https://go-review.googlesource.com/c/go/+/760307 Reviewed-by: Keith Randall <khr@google.com> Auto-Submit: Paul Murphy <paumurph@redhat.com> Reviewed-by: Jorropo <jorropo.pgm@gmail.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2026-03-27cmd/compile/internal/ssa: prove support induction variable pairYoulin Feng
We have two induction variables i and j in the following loop: for i, j := 0, len(s)-1; i < j; i, j = i+1, j-1 { // loop body } This CL enables the prove pass to handle cases where one if block uses two induction variables. Updates #45078 Change-Id: I8b8dc8b7b2d160a796dab1d1e29a00ef4e8e8157 Reviewed-on: https://go-review.googlesource.com/c/go/+/757700 Auto-Submit: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Keith Randall <khr@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-03-27cmd/compile: use prove to remove no-op OrsJorropo
This is hit 3 times (unique by LOC) when building the std. Change-Id: Ic1fc7b60a129e73470d9bc4f603f4be12d154b0f Reviewed-on: https://go-review.googlesource.com/c/go/+/750342 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Jorropo <jorropo.pgm@gmail.com> Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2026-03-27cmd/compile: remove 68857 And flowLimit workaround in proveJorropo
Change-Id: Id8baeb89e6e11a01d53cd63c665f0b2966f50392 Reviewed-on: https://go-review.googlesource.com/c/go/+/750341 Reviewed-by: Mark Freeman <markfreeman@google.com> Auto-Submit: Jorropo <jorropo.pgm@gmail.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Keith Randall <khr@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-03-27cmd/compile: use prove to remove no-op AndsJorropo
This is hit 308 times (unique by LOC) when building the std. There are many hits in defer generated code. My original intent was to optimize cryptographic code that uses And to implement modulus by a power of two but the number is always smaller than the modulus, it also works there but there (unsurprisingly) far fewer hits. Change-Id: Ia7a9a57099b98de966673c6e8231ef09f7c80964 Reviewed-on: https://go-review.googlesource.com/c/go/+/750200 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@google.com> Auto-Submit: Jorropo <jorropo.pgm@gmail.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-03-26cmd/compile: on ARM64 merge shifts into TBZ & TBNZJorropo
Change-Id: I4dff3ba1462848f408257cbadedf202e62d1ea69 Reviewed-on: https://go-review.googlesource.com/c/go/+/750320 Reviewed-by: Keith Randall <khr@google.com> Auto-Submit: Jorropo <jorropo.pgm@gmail.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Keith Randall <khr@golang.org>
2026-03-26cmd/compile: skip incomplete types in needWrapperCuong Manh Le
A recursive pointer type *T may still be a TFORW when the compiler determines if method wrappers are needed. This leads to an incorrect decision and triggers an internal compiler error. Fix this by skipping incomplete types during the method wrapper generation check. Fixes #78295 Change-Id: I4005e525e9b076c6656aed5419283c0418edcac6 Reviewed-on: https://go-review.googlesource.com/c/go/+/758922 Reviewed-by: Jakub Ciolek <jakub@ciolek.dev> Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com> Reviewed-by: Keith Randall <khr@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2026-03-26cmd/compile: do not invert loops that would overflow or underflowJorropo
On the final iteration we need space below start (which becomes end) such that i-step does not overflow or underflow. In other words the code used to assume that the last time the loop header execute `start < i - step` (or `<=`, `>` `>=` based on the loop) is always false. And it seems correct since by definition the only way for it to be the last's loop header execution is when the condition becomes false. However here is an example with uint (even tho the code doesn't already support them) to make things simpler: start = 1 i = 2 step = 100 We do 2 - 100 which should give us 1 < -98 == false breaking the loop; Instead we get 18446744073709551518 which gives 1 < 18446744073709551518 == true which keeps the loop going. This patch fixes this issue by ensuring that in the last execution of a loop header the induction variable does not underflow or overflow. Fixes #78303 Change-Id: I64e8e8592b023d79fdbc7f1598d584726ed601f5 Reviewed-on: https://go-review.googlesource.com/c/go/+/758801 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@google.com> Auto-Submit: Jorropo <jorropo.pgm@gmail.com> Reviewed-by: Jakub Ciolek <jakub@ciolek.dev> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-03-26cmd/compile: fix missing walk for OAS2RECV nodeCuong Manh Le
When channel receive operator is used in the context that requires conversion to destination type, there's an implicit conversion operator inserted by typecheck. This typecheck-ed node is un-walked, then passing to the backend as-is, causing the ICE. Fixes #78313 Change-Id: Ibbc70cbd2d8069cc7cf81934406aa68c4da2686a Reviewed-on: https://go-review.googlesource.com/c/go/+/758660 Reviewed-by: Keith Randall <khr@google.com> Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Jakub Ciolek <jakub@ciolek.dev> Reviewed-by: Keith Randall <khr@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-03-25cmd/compile: preserve variadic signature on range-over-funcCuong Manh Le
When rewriting range-over-func loops, copy the variadic bit from the original function type into the synthesized body closure's type info. This keeps the generated closure signature aligned with the source function and avoids losing variadic-ness during rewrite. Fixes #78314 Change-Id: I4b5f4628e8c8c14d4ff89dd6b996837264c5cb61 Reviewed-on: https://go-review.googlesource.com/c/go/+/758041 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Jakub Ciolek <jakub@ciolek.dev> Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com> Reviewed-by: David Chase <drchase@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2026-03-25cmd/compile: ppc64 fold (x+x)<<c into x<<(c+1)Jayanth Krishnamurthy jayanth.krishnamurthy@ibm.com
On ppc64/ppc64le, rewrite (x + x) << c to x << (c+1) for constant shifts. This removes an ADD, shortens the dependency chain, and reduces code size. Add rules for both 64-bit (SLDconst) and 32-bit (SLWconst), and extend test/codegen/shift.go with ppc64x checks to assert a single SLD/SLW and forbid ADD. Aligns ppc64 with other architectures that already assert similar codegen in shift.go. Change-Id: Ie564afbb029a5bd48887b82b0c455ca1dddd5508 Cq-Include-Trybots: luci.golang.try:gotip-linux-ppc64_power10,gotip-linux-ppc64_power8,gotip-linux-ppc64le_power8,gotip-linux-ppc64le_power9,gotip-linux-ppc64le_power10 Reviewed-on: https://go-review.googlesource.com/c/go/+/712000 Reviewed-by: Archana Ravindar <aravinda@redhat.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Carlos Amedee <carlos@golang.org>
2026-03-24test: repair expected-error regexp in simd.goDavid Chase
The test is only run when GOEXPERIMENT=simd, and currently there are no trybots for that. This error was found after merging to dev.simd, where such trybots ARE run. To run this test: ``` GOEXPERIMENT=simd go test -run=Test/simd.go -v cmd/internal/testdir -target=darwin/amd64 ``` or -target=linux/amd64 if that is your OS. Change-Id: I70e469f080bc62300ff9c18350cc805985e33f9e Reviewed-on: https://go-review.googlesource.com/c/go/+/758980 Auto-Submit: David Chase <drchase@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
2026-03-23test/codegen: add codegen checks for float32/float64 conversions optimizationsJulian Zhu
Updates #75463 Change-Id: Iec51bdedd5a29bbb81ac553ad7e22403e1715ee3 Reviewed-on: https://go-review.googlesource.com/c/go/+/757300 Reviewed-by: Keith Randall <khr@golang.org> Auto-Submit: Keith Randall <khr@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2026-03-20Revert "runtime: disable test for 78081"Keith Randall
This reverts commit bfa3dc402859a92f00b88ebab500d44c64e28185. Reason for revert: re-enabling the test, after CL 757343 is in. Change-Id: I78ebb000b95a14f39fc1f62a1013bc83849a0a37 Reviewed-on: https://go-review.googlesource.com/c/go/+/757226 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Auto-Submit: Keith Randall <khr@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Keith Randall <khr@google.com>
2026-03-20cmd/compile/internal/noder: don't shoot oneself (fix silly mistake)Robert Griesemer
When reading multiple promoted fields in a struct literal from UIR, don't overwrite the (top-level) struct literal type needed for the next field. Fixes #78262. For #9859. Change-Id: Ifac64537bebcb7dbb79a6173d0cd032cbf0b8ed8 Reviewed-on: https://go-review.googlesource.com/c/go/+/757225 Reviewed-by: Robert Griesemer <gri@google.com> Auto-Submit: Robert Griesemer <gri@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Keith Randall <khr@google.com>
2026-03-20runtime: disable test for 78081Keith Randall
The stack we're trying to revert for this issue is tripping on the test for it. The test fails halfway through the revert stack. Disable it for now, we can re-enable once the whole revert stack is in. Change-Id: I3bc2d2f069030d865f799a63ad0f267aa667db07 Reviewed-on: https://go-review.googlesource.com/c/go/+/757224 Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Keith Randall <khr@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Keith Randall <khr@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2026-03-20cmd/compile: on arm64 pair a load with a load in a subsequent blockKeith Randall
Look into the following block(s) for a load that can be paired with the load we're trying to pair up. This particularly helps the generated equality functions. Instead of doing MOVD x(R0), R2 MOVD x(R1), R3 CMP R2, R3 BNE noteq MOVD x+8(R0), R2 MOVD x+8(R1), R3 CMP R2, R3 BNE noteq we do LDP x(R0), (R2, R4) LDP x(R1), (R3, R5) CMP R2, R3 BNE noteq CMP R4, R5 BNE noteq Removes 5296 bytes of code from cmd/go. Change-Id: I6368686892ac944783c8b07ed7252126d1ef4031 Reviewed-on: https://go-review.googlesource.com/c/go/+/740741 Reviewed-by: David Chase <drchase@google.com> Reviewed-by: Keith Randall <khr@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-03-19cmd/compile: enable promoted field selectors as keys in struct literalsRobert Griesemer
Switch the generated UIR version from V2 to V3. Adjust cmd/compile/internal/types to accept promoted field selectors in composite literals. Fixes #9859. Change-Id: Ie314e28567cfa6cf4c9e962a07b32dd05b06bf5e Reviewed-on: https://go-review.googlesource.com/c/go/+/755740 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Robert Griesemer <gri@google.com> Reviewed-by: Mark Freeman <markfreeman@google.com> Reviewed-by: Keith Randall <khr@golang.org>
2026-03-19go/types, types2: allow promoted field names as keys in struct literalsRobert Griesemer
For #9859. Change-Id: Ie4823e726ab43fe2ce1e96c279f63dad6c1f9873 Reviewed-on: https://go-review.googlesource.com/c/go/+/751702 Reviewed-by: Mark Freeman <markfreeman@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Robert Griesemer <gri@google.com>