Skip to content

cmd/compile: loopbce cares about the order of successors in the loop header #74473

Open
@Jorropo

Description

@Jorropo

if len(b.Succs[0].b.Preds) != 1 {
// b.Succs[1] must exit the loop.
continue
}
// Second condition: b.Succs[0] dominates nxt so that
// nxt is computed when inc < limit.
if !sdom.IsAncestorEq(b.Succs[0].b, nxt.Block) {

This code here assumes the the first successor leads to the loop and that second successor break the loop.
it looks like ssagen always generate the for keyword this way but if you write a loop using if ... { break } inside for { ... } this is usually inverted.

Metadata

Metadata

Assignees

Labels

BugReportIssues describing a possible bug in the Go implementation.FixPendingIssues that have a fix which has not yet been reviewed or submitted.Performancecompiler/runtimeIssues related to the Go compiler and/or runtime.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions