| 294 | } |
| 295 | |
| 296 | func getReturnInstrs(fn *ssa.Function) []*ssa.Return { |
| 297 | returnInstrs := make([]*ssa.Return, 0) |
| 298 | for _, b := range fn.Blocks { |
| 299 | // len(x) still returns 0 when x is nil |
| 300 | if len(b.Succs) != 0 || len(b.Instrs) == 0 { |
| 301 | continue |
| 302 | } |
| 303 | // b is an exit block, either panic or return |
| 304 | if instr, ok := b.Instrs[len(b.Instrs)-1].(*ssa.Return); ok { |
| 305 | returnInstrs = append(returnInstrs, instr) |
| 306 | } |
| 307 | } |
| 308 | return returnInstrs |
| 309 | } |
| 310 | |
| 311 | // branch reports whether we can make a branch and learn nilness from the true and false successor. |
| 312 | // The function returns equal, not-equal successor and the binary operation iff |