-
Notifications
You must be signed in to change notification settings - Fork 18.3k
Open
Labels
Performancecompiler/runtimeIssues related to the Go compiler and/or runtime.Issues related to the Go compiler and/or runtime.
Milestone
Description
func f(x interface{}) bool {
if x == nil {
return false
}
switch x.(type) {
case bool:
return true
default:
return false
}
}
Compiles to
0x0000 00000 (/Users/khr/go/tmp4.go:3) MOVQ "".x+8(SP), AX
0x0005 00005 (/Users/khr/go/tmp4.go:4) TESTQ AX, AX
0x0008 00008 (/Users/khr/go/tmp4.go:4) JEQ 47
0x000a 00010 (/Users/khr/go/tmp4.go:7) JEQ 41
...
That second branch is useless. We should get rid of it somehow.
Metadata
Metadata
Assignees
Labels
Performancecompiler/runtimeIssues related to the Go compiler and/or runtime.Issues related to the Go compiler and/or runtime.