Skip to content

cmd/compile: optimize sccp for faster convergence#77399

Open
y1yang0 wants to merge 2 commits intogolang:masterfrom
y1yang0:yyang/fastersccp
Open

cmd/compile: optimize sccp for faster convergence#77399
y1yang0 wants to merge 2 commits intogolang:masterfrom
y1yang0:yyang/fastersccp

Conversation

@y1yang0
Copy link
Contributor

@y1yang0 y1yang0 commented Feb 2, 2026

While investigating other optimizations, I found several
opportunities to accelerate sccp convergence:

  • Avoid adding duplicate uses to the re-visit worklist
  • Prevent queueing uses of values that have already reached the Bottom
  • Add an early exit when processing a value that is already Bottom

These changes provide an overall speedup of ~9% for sccp phase
during a full make.bash run. Also they does not change
the number of constants found or the amount of dead code eliminated.

Updates #77325

This patch optimizes sccp for faster convergence by several improvements

- avoid adding duplicate ueses to the re-visit worklist
- prevent queueing uses of values that have already reached Bottom
- add an early exit when processing a value that is already Bottom

These changes provide an overall speedup of ~9% for sccp during a full make.bash run

Updates golang#77325
@gopherbot
Copy link
Contributor

This PR (HEAD: b3fc7b9) has been imported to Gerrit for code review.

Please visit Gerrit at https://go-review.googlesource.com/c/go/+/740980.

Important tips:

  • Don't comment on this PR. All discussion takes place in Gerrit.
  • You need a Gmail or other Google account to log in to Gerrit.
  • To change your code in response to feedback:
    • Push a new commit to the branch used by your GitHub PR.
    • A new "patch set" will then appear in Gerrit.
    • Respond to each comment by marking as Done in Gerrit if implemented as suggested. You can alternatively write a reply.
    • Critical: you must click the blue Reply button near the top to publish your Gerrit responses.
    • Multiple commits in the PR will be squashed by GerritBot.
  • The title and description of the GitHub PR are used to construct the final commit message.
    • Edit these as needed via the GitHub web interface (not via Gerrit or git).
    • You should word wrap the PR description at ~76 characters unless you need longer lines (e.g., for tables or URLs).
  • See the Sending a change via GitHub and Reviews sections of the Contribution Guide as well as the FAQ for details.

@gopherbot
Copy link
Contributor

Message from Gopher Robot:

Patch Set 1:

(1 comment)


Please don’t reply on this GitHub thread. Visit golang.org/cl/740980.
After addressing review feedback, remember to publish your drafts!

@y1yang0
Copy link
Contributor Author

y1yang0 commented Feb 2, 2026

Some raw data you may find useful(cnt_sorted_: number of constants found or the amount of dead code eliminated, time_sorted_*: phase time consumption)
time_sorted_new.log
time_sorted_new1.log
time_sorted_old.log
time_sorted_old1.log
cnt_sorted_new.log
cnt_sorted_old.log

@gopherbot
Copy link
Contributor

Message from Yi Yang:

Patch Set 2:

(1 comment)


Please don’t reply on this GitHub thread. Visit golang.org/cl/740980.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Jorropo:

Patch Set 2: Commit-Queue+1

(4 comments)


Please don’t reply on this GitHub thread. Visit golang.org/cl/740980.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Go LUCI:

Patch Set 2:

Dry run: CV is trying the patch.

Bot data: {"action":"start","triggered_at":"2026-02-02T07:47:55Z","revision":"8ff18b0b776cf2028c3d7d3d3aebd911df41cd12"}


Please don’t reply on this GitHub thread. Visit golang.org/cl/740980.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Jorropo:

Patch Set 2: -Commit-Queue


Please don’t reply on this GitHub thread. Visit golang.org/cl/740980.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Go LUCI:

Patch Set 2:

This CL has failed the run. Reason:

Tryjob golang/try/x_tools-gotip-linux-amd64 has failed with summary (view all results):


To reproduce, try gomote repro 8690994812547391489.

Additional links for debugging:


Please don’t reply on this GitHub thread. Visit golang.org/cl/740980.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Go LUCI:

Patch Set 2: LUCI-TryBot-Result-1


Please don’t reply on this GitHub thread. Visit golang.org/cl/740980.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Yi Yang:

Patch Set 2:

(3 comments)


Please don’t reply on this GitHub thread. Visit golang.org/cl/740980.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Yi Yang:

Patch Set 2:

(1 comment)


Please don’t reply on this GitHub thread. Visit golang.org/cl/740980.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

This PR (HEAD: 4923155) has been imported to Gerrit for code review.

Please visit Gerrit at https://go-review.googlesource.com/c/go/+/740980.

Important tips:

  • Don't comment on this PR. All discussion takes place in Gerrit.
  • You need a Gmail or other Google account to log in to Gerrit.
  • To change your code in response to feedback:
    • Push a new commit to the branch used by your GitHub PR.
    • A new "patch set" will then appear in Gerrit.
    • Respond to each comment by marking as Done in Gerrit if implemented as suggested. You can alternatively write a reply.
    • Critical: you must click the blue Reply button near the top to publish your Gerrit responses.
    • Multiple commits in the PR will be squashed by GerritBot.
  • The title and description of the GitHub PR are used to construct the final commit message.
    • Edit these as needed via the GitHub web interface (not via Gerrit or git).
    • You should word wrap the PR description at ~76 characters unless you need longer lines (e.g., for tables or URLs).
  • See the Sending a change via GitHub and Reviews sections of the Contribution Guide as well as the FAQ for details.

@gopherbot
Copy link
Contributor

Message from Yi Yang:

Patch Set 3:

(1 comment)


Please don’t reply on this GitHub thread. Visit golang.org/cl/740980.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Keith Randall:

Patch Set 3: Commit-Queue+1


Please don’t reply on this GitHub thread. Visit golang.org/cl/740980.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Go LUCI:

Patch Set 3:

Dry run: CV is trying the patch.

Bot data: {"action":"start","triggered_at":"2026-02-11T06:29:38Z","revision":"f84abede6a15dd8cf46a6118b764c4716be29b01"}


Please don’t reply on this GitHub thread. Visit golang.org/cl/740980.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Keith Randall:

Patch Set 3: -Commit-Queue

(Posted by golang-scoped@luci-project-accounts.iam.gserviceaccount.com on behalf of khr@golang.org)


Please don’t reply on this GitHub thread. Visit golang.org/cl/740980.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Go LUCI:

Patch Set 3:

This CL has passed the run


Please don’t reply on this GitHub thread. Visit golang.org/cl/740980.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Go LUCI:

Patch Set 3: LUCI-TryBot-Result+1


Please don’t reply on this GitHub thread. Visit golang.org/cl/740980.
After addressing review feedback, remember to publish your drafts!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants