Skip to content

最適化の追跡 #32

@omochi

Description

@omochi
func main() -> Int {
    let hoge: Int? = 1
    
    let fuga = hoge
        .map { $0 * 2 }
        .map { $0 + 3 }
        .map { $0 * 4 }
    
    return fuga ?? 99
}

$ swiftc -emit-sil -O c1.swift

// main()
sil hidden @$s2c14mainSiyF : $@convention(thin) () -> Int {
bb0:
  %0 = integer_literal $Builtin.Int64, 20         // user: %1
  %1 = struct $Int (%0 : $Builtin.Int64)          // user: %2
  return %1 : $Int                                // id: %2
} // end sil function '$s2c14mainSiyF'

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions