}
}
- var m int
+ var m float64
if runtime.GOARCH == "amd64" {
- m = 1 // > 99% obtained on amd64, no backsliding
+ m = 0.011 // > 98.9% obtained on amd64, no backsliding
} else if runtime.GOARCH == "riscv64" {
- m = 3 // XXX temporary update threshold to 97% for regabi
+ m = 0.03 // XXX temporary update threshold to 97% for regabi
} else {
- m = 2 // expect 98% elsewhere.
+ m = 0.02 // expect 98% elsewhere.
}
- if len(nonStmtLines)*100 > m*len(lines) {
- t.Errorf("Saw too many (%s, > %d%%) lines without statement marks, total=%d, nostmt=%d ('-run TestStmtLines -v' lists failing lines)\n", runtime.GOARCH, m, len(lines), len(nonStmtLines))
+ if float64(len(nonStmtLines)) > m*float64(len(lines)) {
+ t.Errorf("Saw too many (%s, > %.1f%%) lines without statement marks, total=%d, nostmt=%d ('-run TestStmtLines -v' lists failing lines)\n", runtime.GOARCH, m*100, len(lines), len(nonStmtLines))
}
t.Logf("Saw %d out of %d lines without statement marks", len(nonStmtLines), len(lines))
if testing.Verbose() {
}
// Add a phi to block c for variable n.
hasPhi.add(c.ID)
- v := c.NewValue0I(currentRoot.Pos, ssa.OpPhi, typ, int64(n)) // TODO: line number right?
+ v := c.NewValue0I(s.s.blockStarts[b.ID], ssa.OpPhi, typ, int64(n))
// Note: we store the variable number in the phi's AuxInt field. Used temporarily by phi building.
if var_.Op() == ir.ONAME {
s.s.addNamedValue(var_.(*ir.Name), v)
v.Op = ssa.OpPhi
v.AddArgs(args...)
v.Aux = nil
+ v.Pos = s.s.blockStarts[b.ID]
continue loop
}
w = a // save witness
// First argument of append calls that could be stack allocated.
appendTargets map[ir.Node]bool
+
+ // Block starting position, indexed by block id.
+ blockStarts []src.XPos
}
type funcLine struct {
s.curBlock = b
s.vars = map[ir.Node]*ssa.Value{}
clear(s.fwdVars)
+ for len(s.blockStarts) <= int(b.ID) {
+ s.blockStarts = append(s.blockStarts, src.NoXPos)
+ }
}
// endBlock marks the end of generating code for the current block.
b.Pos = src.NoXPos
} else {
b.Pos = s.lastPos
+ if s.blockStarts[b.ID] == src.NoXPos {
+ s.blockStarts[b.ID] = s.lastPos
+ }
}
return b
}
} else {
s.lastPos = line
}
+ // The first position we see for a new block is its starting position
+ // (the line number for its phis, if any).
+ if b := s.curBlock; b != nil && s.blockStarts[b.ID] == src.NoXPos {
+ s.blockStarts[b.ID] = line
+ }
s.line = append(s.line, line)
}