Skip to content

[cxx-interop] Multiple calls to (function pointers to template functions) crashes the frontend #82001

Open
@costinAndronache

Description

@costinAndronache

Description

I couldn't reproduce it in a simpler test project.
Seems to happen only in my wrapper over GLM code

Reproduction

Given:

//shim.h
// glm header imports

const auto pi_f32 = glm::pi<glm::f32>;
const auto perspective_f32 = glm::perspective<glm::f32>;
const auto rotate_f32 = glm::rotate<glm::f32, glm::qualifier::defaultp>;
const auto translate_f32 = glm::translate<glm::f32, glm::qualifier::defaultp>;
const auto scale_f32 = glm::scale<glm::f32, glm::qualifier::defaultp>;

If I declare multiple calls to either of them

func clipTransformFnPointer(cameraZ: Float, rotations: glm.vec3) -> glm.mat4 {
    let projection = perspective_f32(pi_f32() * 0.25, 3.0 / 4.0, 0.1, 100.0)
    
    let firstTranslate = translate_f32(glm.mat4(1.0), glm.vec3(0, 0, cameraZ))
    let firstRotate = rotate_f32(glm.mat4(1.0), rotations.y, glm.vec3(1.0, 0.0, 1.0))    
    let firstScale = scale_f32(glm.mat4(1.0), glm.vec3(0.5))

     // any of these makes the frontend crash
    let secondTranslate = translate_f32(glm.mat4(1.0), glm.vec3(0, 0, cameraZ))
    let secondRotate = rotate_f32(view, rotations.x, glm.vec3(0.0, 1.0, 0.0))
    let secondScale = scale_f32(glm.mat4(1.0), glm.vec3(2.0))

    let model = firstScale
    let view = firstTranslate * firstRotate
    return projection * view * model
}

The frontend crashes with exception code: 3

error: compile command failed due to exception 3 (use -v to see invocation)
SIL verification failed: branch argument types do not match arguments for dest bb: std::equal(BI->getArgs().begin(), BI->getArgs().end(), BI->getDestBB()->args_begin(), [&](SILValue branchArg, SILArgument *bbArg) { return verifyBranchArgs(branchArg, bbArg); })
Verifying instruction:
     %203 = enum $Optional<@convention(c) (@in_guaranteed glm.mat<_CInt_4, _CInt_4, CFloat, _0>, @in_guaranteed glm.vec<_CInt_3, CFloat, _0>) -> glm.mat<_CInt_4, _CInt_4, CFloat, _0>>, #Optional.some!enumelt, %202 : $@convention(c) (@in_guaranteed glm.mat<_CInt_4, _CInt_4, CFloat, _0>, @in_guaranteed glm.vec<_CInt_3, CFloat, _0>) -> glm.mat<_CInt_4, _CInt_4, CFloat, _0> // user: %204
->   br bb13(%203 : $Optional<@convention(c) (@in_guaranteed glm.mat<_CInt_4, _CInt_4, CFloat, _0>, @in_guaranteed glm.vec<_CInt_3, CFloat, _0>) -> glm.mat<_CInt_4, 
_CInt_4, CFloat, _0>>) // id: %204
In function:
// clipTransformFnPointer(cameraZ:rotations:)
// Isolation: unspecified

Stack dump

PS E:\Git\glmSwift> swift build -v
Building for debugging...
Write auxiliary file E:\Git\glmSwift\.build\x86_64-unknown-windows-msvc\debug\swift-version-7FC4325B17529B4.txt
Write auxiliary file E:\Git\glmSwift\.build\x86_64-unknown-windows-msvc\debug\GLMSwiftDemo.build\sources       
E:\swift\Toolchains\6.1.2+Asserts\usr\bin\swiftc.exe -module-name GLMSwiftDemo -emit-dependencies -emit-module -emit-module-path E:\Git\glmSwift\.build\x86_64-unknown-windows-msvc\debug\Modules\GLMSwiftDemo.swiftmodule -output-file-map E:\Git\glmSwift\.build\x86_64-unknown-windows-msvc\debug\GLMSwiftDemo.build\output-file-map.json -incremental -c @E:\Git\glmSwift\.build\x86_64-unknown-windows-msvc\debug\GLMSwiftDemo.build\sources -I E:\Git\glmSwift\.build\x86_64-unknown-windows-msvc\debug\Modules -target x86_64-unknown-windows-msvc -v -enable-batch-mode -index-store-path E:\Git\glmSwift\.build\x86_64-unknown-windows-msvc\debug\index\store -Onone -enable-testing -j12 -DSWIFT_PACKAGE -DDEBUG -Xcc -fmodule-map-file=E:\Git\glmSwift\.build\x86_64-unknown-windows-msvc\debug\GLMSwift.build\module.modulemap -Xcc -I -Xcc E:\Git\glmSwift\swift\GLMSwift\Sources\include -module-cache-path E:\Git\glmSwift\.build\x86_64-unknown-windows-msvc\debug\ModuleCache -parseable-output -parse-as-library -static -color-diagnostics -swift-version 6 -cxx-interoperability-mode=default -sdk E:\swift\Platforms\6.1.2\Windows.platform\Developer\SDKs\Windows.sdk\ -libc 
MD -I E:\swift\Platforms\6.1.2\Windows.platform\Developer\Library\XCTest-development\usr\lib\swift\windows -I E:\swift\Platforms\6.1.2\Windows.platform\Developer\Library\XCTest-development\usr\lib\swift\windows\x86_64 -L E:\swift\Platforms\6.1.2\Windows.platform\Developer\Library\XCTest-development\usr\lib\swift\windows\x86_64 -I E:\swift\Platforms\6.1.2\Windows.platform\Developer\Library\Testing-development\usr\lib\swift\windows -L E:\swift\Platforms\6.1.2\Windows.platform\Developer\Library\Testing-development\usr\lib\swift\windows\x86_64 -use-ld=lld -g -use-ld=lld -Xcc -D_MT -Xcc -D_DLL -Xcc -Xclang -Xcc --dependent-lib=msvcrt -Xcc -gdwarf -package-name glmswift
Swift version 6.1.2 (swift-6.1.2-RELEASE)
Target: x86_64-unknown-windows-msvc
E:\swift\Toolchains\6.1.2+Asserts\usr\bin\swift-frontend.exe -frontend -c -primary-file E:\Git\glmSwift\swift\GLMSwiftDemo\main.swift -emit-dependencies-path E:\Git\glmSwift\.build\x86_64-unknown-windows-msvc\debug\GLMSwiftDemo.build\main.d -emit-reference-dependencies-path E:\Git\glmSwift\.build\x86_64-unknown-windows-msvc\debug\GLMSwiftDemo.build\main.swiftdeps -target x86_64-unknown-windows-msvc -disable-objc-interop -cxx-interoperability-mode=default -sdk E:\swift\Platforms\6.1.2\Windows.platform\Developer\SDKs\Windows.sdk\ -I E:\Git\glmSwift\.build\x86_64-unknown-windows-msvc\debug\Modules -I E:\swift\Platforms\6.1.2\Windows.platform\Developer\Library\XCTest-development\usr\lib\swift\windows -I E:\swift\Platforms\6.1.2\Windows.platform\Developer\Library\XCTest-development\usr\lib\swift\windows\x86_64 -I E:\swift\Platforms\6.1.2\Windows.platform\Developer\Library\Testing-development\usr\lib\swift\windows -color-diagnostics -enable-testing -g -debug-info-format=dwarf -dwarf-version=4 -module-cache-path E:\Git\glmSwift\.build\x86_64-unknown-windows-msvc\debug\ModuleCache -static -swift-version 6 -Onone -D SWIFT_PACKAGE -D DEBUG -empty-abi-descriptor -resource-dir E:\swift\Toolchains\6.1.2+Asserts\usr\lib\swift -enable-anonymous-context-mangled-names -file-compilation-dir E:\Git\glmSwift -Xcc -fmodule-map-file=E:\Git\glmSwift\.build\x86_64-unknown-windows-msvc\debug\GLMSwift.build\module.modulemap -Xcc -I -Xcc E:\Git\glmSwift\swift\GLMSwift\Sources\include -Xcc -D_MT -Xcc -D_DLL -Xcc -Xclang -Xcc --dependent-lib=msvcrt -Xcc -gdwarf -module-name GLMSwiftDemo -package-name glmswift -in-process-plugin-server-path E:\swift\Toolchains\6.1.2+Asserts\usr\bin\SwiftInProcPluginServer.dll -plugin-path E:\swift\Toolchains\6.1.2+Asserts\usr\bin -plugin-path E:\swift\Toolchains\6.1.2+Asserts\usr\local\bin -parse-as-library -o E:\Git\glmSwift\.build\x86_64-unknown-windows-msvc\debug\GLMSwiftDemo.build\main.swift.o -index-store-path E:\Git\glmSwift\.build\x86_64-unknown-windows-msvc\debug\index\store -index-system-modules
E:\swift\Toolchains\6.1.2+Asserts\usr\bin\swift-frontend.exe -frontend -emit-module -experimental-skip-non-inlinable-function-bodies-without-types E:\Git\glmSwift\swift\GLMSwiftDemo\main.swift -target x86_64-unknown-windows-msvc -disable-objc-interop -cxx-interoperability-mode=default -sdk E:\swift\Platforms\6.1.2\Windows.platform\Developer\SDKs\Windows.sdk\ -I E:\Git\glmSwift\.build\x86_64-unknown-windows-msvc\debug\Modules -I E:\swift\Platforms\6.1.2\Windows.platform\Developer\Library\XCTest-development\usr\lib\swift\windows -I E:\swift\Platforms\6.1.2\Windows.platform\Developer\Library\XCTest-development\usr\lib\swift\windows\x86_64 -I E:\swift\Platforms\6.1.2\Windows.platform\Developer\Library\Testing-development\usr\lib\swift\windows -color-diagnostics -enable-testing -g -debug-info-format=dwarf -dwarf-version=4 -module-cache-path E:\Git\glmSwift\.build\x86_64-unknown-windows-msvc\debug\ModuleCache -static -swift-version 6 -Onone -D SWIFT_PACKAGE -D DEBUG -empty-abi-descriptor -resource-dir E:\swift\Toolchains\6.1.2+Asserts\usr\lib\swift -enable-anonymous-context-mangled-names -file-compilation-dir E:\Git\glmSwift -Xcc -fmodule-map-file=E:\Git\glmSwift\.build\x86_64-unknown-windows-msvc\debug\GLMSwift.build\module.modulemap -Xcc -I -Xcc E:\Git\glmSwift\swift\GLMSwift\Sources\include -Xcc -D_MT 
-Xcc -D_DLL -Xcc -Xclang -Xcc --dependent-lib=msvcrt -Xcc -gdwarf -module-name GLMSwiftDemo -package-name glmswift -in-process-plugin-server-path E:\swift\Toolchains\6.1.2+Asserts\usr\bin\SwiftInProcPluginServer.dll -plugin-path E:\swift\Toolchains\6.1.2+Asserts\usr\bin -plugin-path E:\swift\Toolchains\6.1.2+Asserts\usr\local\bin -emit-module-doc-path E:\Git\glmSwift\.build\x86_64-unknown-windows-msvc\debug\Modules\GLMSwiftDemo.swiftdoc -emit-module-source-info-path E:\Git\glmSwift\.build\x86_64-unknown-windows-msvc\debug\Modules\GLMSwiftDemo.swiftsourceinfo -emit-dependencies-path E:\Git\glmSwift\.build\x86_64-unknown-windows-msvc\debug\GLMSwiftDemo.build\GLMSwiftDemo.emit-module.d -parse-as-library -o E:\Git\glmSwift\.build\x86_64-unknown-windows-msvc\debug\Modules\GLMSwiftDemo.swiftmodule
error: compile command failed due to exception 3 (use -v to see invocation)
SIL verification failed: branch argument types do not match arguments for dest bb: std::equal(BI->getArgs().begin(), BI->getArgs().end(), BI->getDestBB()->args_begin(), [&](SILValue branchArg, SILArgument *bbArg) { return verifyBranchArgs(branchArg, bbArg); })
Verifying instruction:
     %203 = enum $Optional<@convention(c) (@in_guaranteed glm.mat<_CInt_4, _CInt_4, CFloat, _0>, @in_guaranteed glm.vec<_CInt_3, CFloat, _0>) -> glm.mat<_CInt_4, _CInt_4, CFloat, _0>>, #Optional.some!enumelt, %202 : $@convention(c) (@in_guaranteed glm.mat<_CInt_4, _CInt_4, CFloat, _0>, @in_guaranteed glm.vec<_CInt_3, CFloat, _0>) -> glm.mat<_CInt_4, _CInt_4, CFloat, _0> // user: %204
->   br bb13(%203 : $Optional<@convention(c) (@in_guaranteed glm.mat<_CInt_4, _CInt_4, CFloat, _0>, @in_guaranteed glm.vec<_CInt_3, CFloat, _0>) -> glm.mat<_CInt_4, 
_CInt_4, CFloat, _0>>) // id: %204
In function:
// clipTransformFnPointer(cameraZ:rotations:)
// Isolation: unspecified
sil [ossa] @$s12GLMSwiftDemo22clipTransformFnPointer7cameraZ9rotationsSo3glmO0045mat_CInt_4_CInt_4CFloat_0_JuFIihagGEaiahBAcGcVSf_AF0034vec_CInt_3CFloat_0_JfAHfgaIvhGGajcVtF : $@convention(thin) (Float, glm.vec<_CInt_3, CFloat, _0>) -> glm.mat<_CInt_4, _CInt_4, CFloat, _0> {
// %0 "cameraZ"                                   // users: %239, %97, %7
// %1 "rotations"                                 // users: %132, %8
bb0(%0 : $Float, %1 : $glm.vec<_CInt_3, CFloat, _0>):
  %2 = global_addr @scale_f32 : $*Optional<@convention(c) (@in_guaranteed glm.mat<_CInt_4, _CInt_4, CFloat, _0>, @in_guaranteed glm.vec<_CInt_3, CFloat, _0>) -> glm.mat<_CInt_4, _CInt_4, CFloat, _0>> // user: %159
  %3 = global_addr @rotate_f32 : $*Optional<@convention(c) (@in_guaranteed glm.mat<_CInt_4, _CInt_4, CFloat, _0>, Float, @in_guaranteed glm.vec<_CInt_3, CFloat, _0>) -> glm.mat<_CInt_4, _CInt_4, CFloat, _0>> // user: %108
  %4 = global_addr @translate_f32 : $*Optional<@convention(c) (@in_guaranteed glm.mat<_CInt_4, _CInt_4, CFloat, _0>, @in_guaranteed glm.vec<_CInt_3, CFloat, _0>) -> 
glm.mat<_CInt_4, _CInt_4, CFloat, _0>> // users: %200, %63
  %5 = global_addr @pi_f32 : $*Optional<@convention(c) () -> Float> // user: %22
  %6 = global_addr @perspective_f32 : $*Optional<@convention(c) (Float, Float, Float, Float) -> glm.mat<_CInt_4, _CInt_4, CFloat, _0>> // user: %9
  debug_value %0 : $Float, let, name "cameraZ", argno 1 // id: %7
  debug_value %1 : $glm.vec<_CInt_3, CFloat, _0>, let, name "rotations", argno 2 // id: %8
  %9 = load [trivial] %6 : $*Optional<@convention(c) (Float, Float, Float, Float) -> glm.mat<_CInt_4, _CInt_4, CFloat, _0>> // user: %10
  switch_enum %9 : $Optional<@convention(c) (Float, Float, Float, Float) -> glm.mat<_CInt_4, _CInt_4, CFloat, _0>>, case #Optional.some!enumelt: bb2, case #Optional.none!enumelt: bb1 // id: %10

bb1:                                              // Preds: bb0
  %11 = string_literal utf8 "GLMSwiftDemo/main.swift" // user: %18
  %12 = integer_literal $Builtin.Word, 23         // user: %18
  %13 = integer_literal $Builtin.Int1, -1         // user: %18
  %14 = integer_literal $Builtin.Word, 5          // user: %18
  %15 = integer_literal $Builtin.Word, 22
  %16 = integer_literal $Builtin.Int1, -1         // user: %18
  // function_ref _diagnoseUnexpectedNilOptional(_filenameStart:_filenameLength:_filenameIsASCII:_line:_isImplicitUnwrap:)
  %17 = function_ref @$ss30_diagnoseUnexpectedNilOptional14_filenameStart01_E6Length01_E7IsASCII5_line17_isImplicitUnwrapyBp_BwBi1_BwBi1_tF : $@convention(thin) (Builtin.RawPointer, Builtin.Word, Builtin.Int1, Builtin.Word, Builtin.Int1) -> () // user: %18
  %18 = apply %17(%11, %12, %13, %14, %16) : $@convention(thin) (Builtin.RawPointer, Builtin.Word, Builtin.Int1, Builtin.Word, Builtin.Int1) -> ()
  unreachable                                     // id: %19

// %20                                            // user: %60
bb2(%20 : $@convention(c) (Float, Float, Float, Float) -> glm.mat<_CInt_4, _CInt_4, CFloat, _0>): // Preds: bb0
  %21 = metatype $@thin Float.Type                // user: %40
  %22 = load [trivial] %5 : $*Optional<@convention(c) () -> Float> // user: %23
  switch_enum %22 : $Optional<@convention(c) () -> Float>, case #Optional.some!enumelt: bb4, case #Optional.none!enumelt: bb3 // id: %23

bb3:                                              // Preds: bb2
  %24 = string_literal utf8 "GLMSwiftDemo/main.swift" // user: %31
  %25 = integer_literal $Builtin.Word, 23         // user: %31
  %26 = integer_literal $Builtin.Int1, -1         // user: %31
  %27 = integer_literal $Builtin.Word, 5          // user: %31
  %28 = integer_literal $Builtin.Word, 38
  %29 = integer_literal $Builtin.Int1, -1         // user: %31
  // function_ref _diagnoseUnexpectedNilOptional(_filenameStart:_filenameLength:_filenameIsASCII:_line:_isImplicitUnwrap:)
  %30 = function_ref @$ss30_diagnoseUnexpectedNilOptional14_filenameStart01_E6Length01_E7IsASCII5_line17_isImplicitUnwrapyBp_BwBi1_BwBi1_tF : $@convention(thin) (Builtin.RawPointer, Builtin.Word, Builtin.Int1, Builtin.Word, Builtin.Int1) -> () // user: %31
  %31 = apply %30(%24, %25, %26, %27, %29) : $@convention(thin) (Builtin.RawPointer, Builtin.Word, Builtin.Int1, Builtin.Word, Builtin.Int1) -> ()
  unreachable                                     // id: %32

// %33                                            // user: %34
bb4(%33 : $@convention(c) () -> Float):           // Preds: bb2
  %34 = apply %33() : $@convention(c) () -> Float // user: %40
  %35 = float_literal $Builtin.FPIEEE64, 0x3FD0000000000000 // 0.25 // user: %38
  %36 = metatype $@thin Float.Type                // user: %38
  // function_ref Float.init(_builtinFloatLiteral:)
  %37 = function_ref @$sSf20_builtinFloatLiteralSfBf64__tcfC : $@convention(method) (Builtin.FPIEEE64, @thin Float.Type) -> Float // user: %38
  %38 = apply %37(%35, %36) : $@convention(method) (Builtin.FPIEEE64, @thin Float.Type) -> Float // user: %40
  // function_ref static Float.* infix(_:_:)
  %39 = function_ref @$sSf1moiyS2f_SftFZ : $@convention(method) (Float, Float, @thin Float.Type) -> Float // user: %40
  %40 = apply %39(%34, %38, %21) : $@convention(method) (Float, Float, @thin Float.Type) -> Float // user: %60
  %41 = metatype $@thin Float.Type                // user: %51
  %42 = float_literal $Builtin.FPIEEE64, 0x4008000000000000 // 3 // user: %45
  %43 = metatype $@thin Float.Type                // user: %45
  // function_ref Float.init(_builtinFloatLiteral:)
  %44 = function_ref @$sSf20_builtinFloatLiteralSfBf64__tcfC : $@convention(method) (Builtin.FPIEEE64, @thin Float.Type) -> Float // user: %45
  %45 = apply %44(%42, %43) : $@convention(method) (Builtin.FPIEEE64, @thin Float.Type) -> Float // user: %51
  %46 = float_literal $Builtin.FPIEEE64, 0x4010000000000000 // 4 // user: %49
  %47 = metatype $@thin Float.Type                // user: %49
  // function_ref Float.init(_builtinFloatLiteral:)
  %48 = function_ref @$sSf20_builtinFloatLiteralSfBf64__tcfC : $@convention(method) (Builtin.FPIEEE64, @thin Float.Type) -> Float // user: %49
  %49 = apply %48(%46, %47) : $@convention(method) (Builtin.FPIEEE64, @thin Float.Type) -> Float // user: %51
  // function_ref static Float./ infix(_:_:)
  %50 = function_ref @$sSf1doiyS2f_SftFZ : $@convention(method) (Float, Float, @thin Float.Type) -> Float // user: %51
  %51 = apply %50(%45, %49, %41) : $@convention(method) (Float, Float, @thin Float.Type) -> Float // user: %60
  %52 = float_literal $Builtin.FPIEEE64, 0x3FB999999999999A // 0.10000000000000001 // user: %55
  %53 = metatype $@thin Float.Type                // user: %55
  // function_ref Float.init(_builtinFloatLiteral:)
  %54 = function_ref @$sSf20_builtinFloatLiteralSfBf64__tcfC : $@convention(method) (Builtin.FPIEEE64, @thin Float.Type) -> Float // user: %55
  %55 = apply %54(%52, %53) : $@convention(method) (Builtin.FPIEEE64, @thin Float.Type) -> Float // user: %60
  %56 = float_literal $Builtin.FPIEEE64, 0x4059000000000000 // 100 // user: %59
  %57 = metatype $@thin Float.Type                // user: %59
  // function_ref Float.init(_builtinFloatLiteral:)
  %58 = function_ref @$sSf20_builtinFloatLiteralSfBf64__tcfC : $@convention(method) (Builtin.FPIEEE64, @thin Float.Type) -> Float // user: %59
  %59 = apply %58(%56, %57) : $@convention(method) (Builtin.FPIEEE64, @thin Float.Type) -> Float // user: %60
  %60 = apply %20(%40, %51, %55, %59) : $@convention(c) (Float, Float, Float, Float) -> glm.mat<_CInt_4, _CInt_4, CFloat, _0> // user: %61
  %61 = move_value [var_decl] %60 : $glm.mat<_CInt_4, _CInt_4, CFloat, _0> // users: %262, %253, %62
  debug_value %61 : $glm.mat<_CInt_4, _CInt_4, CFloat, _0>, let, name "projection" // id: %62
  %63 = load [trivial] %4 : $*Optional<@convention(c) (@in_guaranteed glm.mat<_CInt_4, _CInt_4, CFloat, _0>, @in_guaranteed glm.vec<_CInt_3, CFloat, _0>) -> glm.mat<_CInt_4, _CInt_4, CFloat, _0>> // user: %64
  switch_enum %63 : $Optional<@convention(c) (@in_guaranteed glm.mat<_CInt_4, _CInt_4, CFloat, _0>, @in_guaranteed glm.vec<_CInt_3, CFloat, _0>) -> glm.mat<_CInt_4, 
_CInt_4, CFloat, _0>>, case #Optional.some!enumelt: bb6, case #Optional.none!enumelt: bb5 // id: %64

bb5:                                              // Preds: bb4
  %65 = string_literal utf8 "GLMSwiftDemo/main.swift" // user: %72
  %66 = integer_literal $Builtin.Word, 23         // user: %72
  %67 = integer_literal $Builtin.Int1, -1         // user: %72
  %68 = integer_literal $Builtin.Word, 7          // user: %72
  %69 = integer_literal $Builtin.Word, 26
  %70 = integer_literal $Builtin.Int1, -1         // user: %72
  // function_ref _diagnoseUnexpectedNilOptional(_filenameStart:_filenameLength:_filenameIsASCII:_line:_isImplicitUnwrap:)
  %71 = function_ref @$ss30_diagnoseUnexpectedNilOptional14_filenameStart01_E6Length01_E7IsASCII5_line17_isImplicitUnwrapyBp_BwBi1_BwBi1_tF : $@convention(thin) (Builtin.RawPointer, Builtin.Word, Builtin.Int1, Builtin.Word, Builtin.Int1) -> () // user: %72
  %72 = apply %71(%65, %66, %67, %68, %70) : $@convention(thin) (Builtin.RawPointer, Builtin.Word, Builtin.Int1, Builtin.Word, Builtin.Int1) -> ()
  unreachable                                     // id: %73

// %74                                            // user: %101
bb6(%74 : $@convention(c) (@in_guaranteed glm.mat<_CInt_4, _CInt_4, CFloat, _0>, @in_guaranteed glm.vec<_CInt_3, CFloat, _0>) -> glm.mat<_CInt_4, _CInt_4, CFloat, _0>): // Preds: bb4
  %75 = alloc_stack $glm.mat<_CInt_4, _CInt_4, CFloat, _0> // users: %105, %83, %82
  %76 = metatype $@thin glm.mat<_CInt_4, _CInt_4, CFloat, _0>.Type
  %77 = float_literal $Builtin.FPIEEE64, 0x3FF0000000000000 // 1 // user: %80
  %78 = metatype $@thin Float.Type                // user: %80
  // function_ref Float.init(_builtinFloatLiteral:)
  %79 = function_ref @$sSf20_builtinFloatLiteralSfBf64__tcfC : $@convention(method) (Builtin.FPIEEE64, @thin Float.Type) -> Float // user: %80
  %80 = apply %79(%77, %78) : $@convention(method) (Builtin.FPIEEE64, @thin Float.Type) -> Float // user: %82
  // function_ref ??0?$mat@$03$03M$0A@@glm@@QEAA@M@Z
  %81 = function_ref @??0?$mat@$03$03M$0A@@glm@@QEAA@M@Z : $@convention(c) (Float) -> @out glm.mat<_CInt_4, _CInt_4, CFloat, _0> // user: %82
  %82 = apply %81(%75, %80) : $@convention(c) (Float) -> @out glm.mat<_CInt_4, _CInt_4, CFloat, _0>
  %83 = load [trivial] %75 : $*glm.mat<_CInt_4, _CInt_4, CFloat, _0> // user: %85
  %84 = alloc_stack $glm.mat<_CInt_4, _CInt_4, CFloat, _0> // users: %104, %101, %85
  store %83 to [trivial] %84 : $*glm.mat<_CInt_4, _CInt_4, CFloat, _0> // id: %85
  %86 = alloc_stack $glm.vec<_CInt_3, CFloat, _0> // users: %103, %98, %97
  %87 = metatype $@thin glm.vec<_CInt_3, CFloat, _0>.Type
  %88 = integer_literal $Builtin.IntLiteral, 0    // user: %91
  %89 = metatype $@thin Int.Type                  // user: %91
  // function_ref Int.init(_builtinIntegerLiteral:)
  %90 = function_ref @$sSi22_builtinIntegerLiteralSiBI_tcfC : $@convention(method) (Builtin.IntLiteral, @thin Int.Type) -> Int // user: %91
  %91 = apply %90(%88, %89) : $@convention(method) (Builtin.IntLiteral, @thin Int.Type) -> Int // user: %97
  %92 = integer_literal $Builtin.IntLiteral, 0    // user: %95
  %93 = metatype $@thin Int.Type                  // user: %95
  // function_ref Int.init(_builtinIntegerLiteral:)
  %94 = function_ref @$sSi22_builtinIntegerLiteralSiBI_tcfC : $@convention(method) (Builtin.IntLiteral, @thin Int.Type) -> Int // user: %95
  %95 = apply %94(%92, %93) : $@convention(method) (Builtin.IntLiteral, @thin Int.Type) -> Int // user: %97
  // function_ref ??$?0_J_JM@?$vec@$02M$0A@@glm@@QEAA@_J0M@Z
  %96 = function_ref @??$?0_J_JM@?$vec@$02M$0A@@glm@@QEAA@_J0M@Z : $@convention(c) (Int, Int, Float) -> @out glm.vec<_CInt_3, CFloat, _0> // user: %97
  %97 = apply %96(%86, %91, %95, %0) : $@convention(c) (Int, Int, Float) -> @out glm.vec<_CInt_3, CFloat, _0>
  %98 = load [trivial] %86 : $*glm.vec<_CInt_3, CFloat, _0> // user: %100
  %99 = alloc_stack $glm.vec<_CInt_3, CFloat, _0> // users: %102, %101, %100
  store %98 to [trivial] %99 : $*glm.vec<_CInt_3, CFloat, _0> // id: %100
  %101 = apply %74(%84, %99) : $@convention(c) (@in_guaranteed glm.mat<_CInt_4, _CInt_4, CFloat, _0>, @in_guaranteed glm.vec<_CInt_3, CFloat, _0>) -> glm.mat<_CInt_4, _CInt_4, CFloat, _0> // user: %106
  dealloc_stack %99 : $*glm.vec<_CInt_3, CFloat, _0> // id: %102
  dealloc_stack %86 : $*glm.vec<_CInt_3, CFloat, _0> // id: %103
  dealloc_stack %84 : $*glm.mat<_CInt_4, _CInt_4, CFloat, _0> // id: %104
  dealloc_stack %75 : $*glm.mat<_CInt_4, _CInt_4, CFloat, _0> // id: %105
  %106 = move_value [var_decl] %101 : $glm.mat<_CInt_4, _CInt_4, CFloat, _0> // users: %261, %249, %107
  debug_value %106 : $glm.mat<_CInt_4, _CInt_4, CFloat, _0>, let, name "firstTranslate" // id: %107
  %108 = load [trivial] %3 : $*Optional<@convention(c) (@in_guaranteed glm.mat<_CInt_4, _CInt_4, CFloat, _0>, Float, @in_guaranteed glm.vec<_CInt_3, CFloat, _0>) -> 
glm.mat<_CInt_4, _CInt_4, CFloat, _0>> // user: %109
  switch_enum %108 : $Optional<@convention(c) (@in_guaranteed glm.mat<_CInt_4, _CInt_4, CFloat, _0>, Float, @in_guaranteed glm.vec<_CInt_3, CFloat, _0>) -> glm.mat<_CInt_4, _CInt_4, CFloat, _0>>, case #Optional.some!enumelt: bb8, case #Optional.none!enumelt: bb7 // id: %109

bb7:                                              // Preds: bb6
  %110 = string_literal utf8 "GLMSwiftDemo/main.swift" // user: %117
  %111 = integer_literal $Builtin.Word, 23        // user: %117
  %112 = integer_literal $Builtin.Int1, -1        // user: %117
  %113 = integer_literal $Builtin.Word, 8         // user: %117
  %114 = integer_literal $Builtin.Word, 23
  %115 = integer_literal $Builtin.Int1, -1        // user: %117
  // function_ref _diagnoseUnexpectedNilOptional(_filenameStart:_filenameLength:_filenameIsASCII:_line:_isImplicitUnwrap:)
  %116 = function_ref @$ss30_diagnoseUnexpectedNilOptional14_filenameStart01_E6Length01_E7IsASCII5_line17_isImplicitUnwrapyBp_BwBi1_BwBi1_tF : $@convention(thin) (Builtin.RawPointer, Builtin.Word, Builtin.Int1, Builtin.Word, Builtin.Int1) -> () // user: %117
  %117 = apply %116(%110, %111, %112, %113, %115) : $@convention(thin) (Builtin.RawPointer, Builtin.Word, Builtin.Int1, Builtin.Word, Builtin.Int1) -> ()
  unreachable                                     // id: %118

// %119                                           // user: %152
bb8(%119 : $@convention(c) (@in_guaranteed glm.mat<_CInt_4, _CInt_4, CFloat, _0>, Float, @in_guaranteed glm.vec<_CInt_3, CFloat, _0>) -> glm.mat<_CInt_4, _CInt_4, CFloat, _0>): // Preds: bb6
  %120 = alloc_stack $glm.mat<_CInt_4, _CInt_4, CFloat, _0> // users: %156, %128, %127
  %121 = metatype $@thin glm.mat<_CInt_4, _CInt_4, CFloat, _0>.Type
  %122 = float_literal $Builtin.FPIEEE64, 0x3FF0000000000000 // 1 // user: %125
  %123 = metatype $@thin Float.Type               // user: %125
  // function_ref Float.init(_builtinFloatLiteral:)
  %124 = function_ref @$sSf20_builtinFloatLiteralSfBf64__tcfC : $@convention(method) (Builtin.FPIEEE64, @thin Float.Type) -> Float // user: %125
  %125 = apply %124(%122, %123) : $@convention(method) (Builtin.FPIEEE64, @thin Float.Type) -> Float // user: %127
  // function_ref ??0?$mat@$03$03M$0A@@glm@@QEAA@M@Z
  %126 = function_ref @??0?$mat@$03$03M$0A@@glm@@QEAA@M@Z : $@convention(c) (Float) -> @out glm.mat<_CInt_4, _CInt_4, CFloat, _0> // user: %127
  %127 = apply %126(%120, %125) : $@convention(c) (Float) -> @out glm.mat<_CInt_4, _CInt_4, CFloat, _0>
  %128 = load [trivial] %120 : $*glm.mat<_CInt_4, _CInt_4, CFloat, _0> // user: %130
  %129 = alloc_stack $glm.mat<_CInt_4, _CInt_4, CFloat, _0> // users: %155, %152, %130
  store %128 to [trivial] %129 : $*glm.mat<_CInt_4, _CInt_4, CFloat, _0> // id: %130
  // function_ref glm.vec<_CInt_3, CFloat, _0>.y.getter
  %131 = function_ref @$sSo3glmO0034vec_CInt_3CFloat_0_JfAHfgaIvhGGajcV1ySfvg : $@convention(method) (glm.vec<_CInt_3, CFloat, _0>) -> Float // user: %132
  %132 = apply %131(%1) : $@convention(method) (glm.vec<_CInt_3, CFloat, _0>) -> Float // user: %152
  %133 = alloc_stack $glm.vec<_CInt_3, CFloat, _0> // users: %154, %149, %148
  %134 = metatype $@thin glm.vec<_CInt_3, CFloat, _0>.Type
  %135 = float_literal $Builtin.FPIEEE64, 0x3FF0000000000000 // 1 // user: %138
  %136 = metatype $@thin Double.Type              // user: %138
  // function_ref Double.init(_builtinFloatLiteral:)
  %137 = function_ref @$sSd20_builtinFloatLiteralSdBf64__tcfC : $@convention(method) (Builtin.FPIEEE64, @thin Double.Type) -> Double // user: %138
  %138 = apply %137(%135, %136) : $@convention(method) (Builtin.FPIEEE64, @thin Double.Type) -> Double // user: %148
  %139 = float_literal $Builtin.FPIEEE64, 0x0 // 0 // user: %142
  %140 = metatype $@thin Double.Type              // user: %142
  // function_ref Double.init(_builtinFloatLiteral:)
  %141 = function_ref @$sSd20_builtinFloatLiteralSdBf64__tcfC : $@convention(method) (Builtin.FPIEEE64, @thin Double.Type) -> Double // user: %142
  %142 = apply %141(%139, %140) : $@convention(method) (Builtin.FPIEEE64, @thin Double.Type) -> Double // user: %148
  %143 = float_literal $Builtin.FPIEEE64, 0x3FF0000000000000 // 1 // user: %146
  %144 = metatype $@thin Double.Type              // user: %146
  // function_ref Double.init(_builtinFloatLiteral:)
  %145 = function_ref @$sSd20_builtinFloatLiteralSdBf64__tcfC : $@convention(method) (Builtin.FPIEEE64, @thin Double.Type) -> Double // user: %146
  %146 = apply %145(%143, %144) : $@convention(method) (Builtin.FPIEEE64, @thin Double.Type) -> Double // user: %148
  // function_ref ??$?0NNN@?$vec@$02M$0A@@glm@@QEAA@NNN@Z
  %147 = function_ref @??$?0NNN@?$vec@$02M$0A@@glm@@QEAA@NNN@Z : $@convention(c) (Double, Double, Double) -> @out glm.vec<_CInt_3, CFloat, _0> // user: %148
  %148 = apply %147(%133, %138, %142, %146) : $@convention(c) (Double, Double, Double) -> @out glm.vec<_CInt_3, CFloat, _0>
  %149 = load [trivial] %133 : $*glm.vec<_CInt_3, CFloat, _0> // user: %151
  %150 = alloc_stack $glm.vec<_CInt_3, CFloat, _0> // users: %153, %152, %151
  store %149 to [trivial] %150 : $*glm.vec<_CInt_3, CFloat, _0> // id: %151
  %152 = apply %119(%129, %132, %150) : $@convention(c) (@in_guaranteed glm.mat<_CInt_4, _CInt_4, CFloat, _0>, Float, @in_guaranteed glm.vec<_CInt_3, CFloat, _0>) -> glm.mat<_CInt_4, _CInt_4, CFloat, _0> // user: %157
  dealloc_stack %150 : $*glm.vec<_CInt_3, CFloat, _0> // id: %153
  dealloc_stack %133 : $*glm.vec<_CInt_3, CFloat, _0> // id: %154
  dealloc_stack %129 : $*glm.mat<_CInt_4, _CInt_4, CFloat, _0> // id: %155
  dealloc_stack %120 : $*glm.mat<_CInt_4, _CInt_4, CFloat, _0> // id: %156
  %157 = move_value [var_decl] %152 : $glm.mat<_CInt_4, _CInt_4, CFloat, _0> // users: %260, %249, %158
  debug_value %157 : $glm.mat<_CInt_4, _CInt_4, CFloat, _0>, let, name "firstRotate" // id: %158
  %159 = load [trivial] %2 : $*Optional<@convention(c) (@in_guaranteed glm.mat<_CInt_4, _CInt_4, CFloat, _0>, @in_guaranteed glm.vec<_CInt_3, CFloat, _0>) -> glm.mat<_CInt_4, _CInt_4, CFloat, _0>> // user: %160
  switch_enum %159 : $Optional<@convention(c) (@in_guaranteed glm.mat<_CInt_4, _CInt_4, CFloat, _0>, @in_guaranteed glm.vec<_CInt_3, CFloat, _0>) -> glm.mat<_CInt_4, _CInt_4, CFloat, _0>>, case #Optional.some!enumelt: bb10, case #Optional.none!enumelt: bb9 // id: %160

bb9:                                              // Preds: bb8
  %161 = string_literal utf8 "GLMSwiftDemo/main.swift" // user: %168
  %162 = integer_literal $Builtin.Word, 23        // user: %168
  %163 = integer_literal $Builtin.Int1, -1        // user: %168
  %164 = integer_literal $Builtin.Word, 9         // user: %168
  %165 = integer_literal $Builtin.Word, 22
  %166 = integer_literal $Builtin.Int1, -1        // user: %168
  // function_ref _diagnoseUnexpectedNilOptional(_filenameStart:_filenameLength:_filenameIsASCII:_line:_isImplicitUnwrap:)
  %167 = function_ref @$ss30_diagnoseUnexpectedNilOptional14_filenameStart01_E6Length01_E7IsASCII5_line17_isImplicitUnwrapyBp_BwBi1_BwBi1_tF : $@convention(thin) (Builtin.RawPointer, Builtin.Word, Builtin.Int1, Builtin.Word, Builtin.Int1) -> () // user: %168
  %168 = apply %167(%161, %162, %163, %164, %166) : $@convention(thin) (Builtin.RawPointer, Builtin.Word, Builtin.Int1, Builtin.Word, Builtin.Int1) -> ()
  unreachable                                     // id: %169

// %170                                           // user: %193
bb10(%170 : $@convention(c) (@in_guaranteed glm.mat<_CInt_4, _CInt_4, CFloat, _0>, @in_guaranteed glm.vec<_CInt_3, CFloat, _0>) -> glm.mat<_CInt_4, _CInt_4, CFloat, 
_0>): // Preds: bb8
  %171 = alloc_stack $glm.mat<_CInt_4, _CInt_4, CFloat, _0> // users: %197, %179, %178
  %172 = metatype $@thin glm.mat<_CInt_4, _CInt_4, CFloat, _0>.Type
  %173 = float_literal $Builtin.FPIEEE64, 0x3FF0000000000000 // 1 // user: %176
  %174 = metatype $@thin Float.Type               // user: %176
  // function_ref Float.init(_builtinFloatLiteral:)
  %175 = function_ref @$sSf20_builtinFloatLiteralSfBf64__tcfC : $@convention(method) (Builtin.FPIEEE64, @thin Float.Type) -> Float // user: %176
  %176 = apply %175(%173, %174) : $@convention(method) (Builtin.FPIEEE64, @thin Float.Type) -> Float // user: %178
  // function_ref ??0?$mat@$03$03M$0A@@glm@@QEAA@M@Z
  %177 = function_ref @??0?$mat@$03$03M$0A@@glm@@QEAA@M@Z : $@convention(c) (Float) -> @out glm.mat<_CInt_4, _CInt_4, CFloat, _0> // user: %178
  %178 = apply %177(%171, %176) : $@convention(c) (Float) -> @out glm.mat<_CInt_4, _CInt_4, CFloat, _0>
  %179 = load [trivial] %171 : $*glm.mat<_CInt_4, _CInt_4, CFloat, _0> // user: %181
  %180 = alloc_stack $glm.mat<_CInt_4, _CInt_4, CFloat, _0> // users: %196, %193, %181
  store %179 to [trivial] %180 : $*glm.mat<_CInt_4, _CInt_4, CFloat, _0> // id: %181
  %182 = alloc_stack $glm.vec<_CInt_3, CFloat, _0> // users: %195, %190, %189
  %183 = metatype $@thin glm.vec<_CInt_3, CFloat, _0>.Type
  %184 = float_literal $Builtin.FPIEEE64, 0x3FE0000000000000 // 0.5 // user: %187
  %185 = metatype $@thin Float.Type               // user: %187
  // function_ref Float.init(_builtinFloatLiteral:)
  %186 = function_ref @$sSf20_builtinFloatLiteralSfBf64__tcfC : $@convention(method) (Builtin.FPIEEE64, @thin Float.Type) -> Float // user: %187
  %187 = apply %186(%184, %185) : $@convention(method) (Builtin.FPIEEE64, @thin Float.Type) -> Float // user: %189
  // function_ref ??0?$vec@$02M$0A@@glm@@QEAA@M@Z
  %188 = function_ref @??0?$vec@$02M$0A@@glm@@QEAA@M@Z : $@convention(c) (Float) -> @out glm.vec<_CInt_3, CFloat, _0> // user: %189
  %189 = apply %188(%182, %187) : $@convention(c) (Float) -> @out glm.vec<_CInt_3, CFloat, _0>
  %190 = load [trivial] %182 : $*glm.vec<_CInt_3, CFloat, _0> // user: %192
  %191 = alloc_stack $glm.vec<_CInt_3, CFloat, _0> // users: %194, %193, %192
  store %190 to [trivial] %191 : $*glm.vec<_CInt_3, CFloat, _0> // id: %192
  %193 = apply %170(%180, %191) : $@convention(c) (@in_guaranteed glm.mat<_CInt_4, _CInt_4, CFloat, _0>, @in_guaranteed glm.vec<_CInt_3, CFloat, _0>) -> glm.mat<_CInt_4, _CInt_4, CFloat, _0> // user: %198
  dealloc_stack %191 : $*glm.vec<_CInt_3, CFloat, _0> // id: %194
  dealloc_stack %182 : $*glm.vec<_CInt_3, CFloat, _0> // id: %195
  dealloc_stack %180 : $*glm.mat<_CInt_4, _CInt_4, CFloat, _0> // id: %196
  dealloc_stack %171 : $*glm.mat<_CInt_4, _CInt_4, CFloat, _0> // id: %197
  %198 = move_value [var_decl] %193 : $glm.mat<_CInt_4, _CInt_4, CFloat, _0> // users: %259, %246, %199
  debug_value %198 : $glm.mat<_CInt_4, _CInt_4, CFloat, _0>, let, name "firstScale" // id: %199
  %200 = load [trivial] %4 : $*Optional<@convention(c) (@in_guaranteed glm.mat<_CInt_4, _CInt_4, CFloat, _0>, @in_guaranteed glm.vec<_CInt_3, CFloat, _0>) -> glm.mat<_CInt_4, _CInt_4, CFloat, _0>> // user: %201
  switch_enum %200 : $Optional<@convention(c) (@in_guaranteed glm.mat<_CInt_4, _CInt_4, CFloat, _0>, @in_guaranteed glm.vec<_CInt_3, CFloat, _0>) -> glm.mat<_CInt_4, _CInt_4, CFloat, _0>>, case #Optional.some!enumelt: bb11, case #Optional.none!enumelt: bb12 // id: %201

// %202                                           // user: %203
bb11(%202 : $@convention(c) (@in_guaranteed glm.mat<_CInt_4, _CInt_4, CFloat, _0>, @in_guaranteed glm.vec<_CInt_3, CFloat, _0>) -> glm.mat<_CInt_4, _CInt_4, CFloat, 
_0>): // Preds: bb10
  %203 = enum $Optional<@convention(c) (@in_guaranteed glm.mat<_CInt_4, _CInt_4, CFloat, _0>, @in_guaranteed glm.vec<_CInt_3, CFloat, _0>) -> glm.mat<_CInt_4, _CInt_4, CFloat, _0>>, #Optional.some!enumelt, %202 : $@convention(c) (@in_guaranteed glm.mat<_CInt_4, _CInt_4, CFloat, _0>, @in_guaranteed glm.vec<_CInt_3, CFloat, _0>) -> glm.mat<_CInt_4, _CInt_4, CFloat, _0> // user: %204
  br bb13(%203 : $Optional<@convention(c) (@in_guaranteed glm.mat<_CInt_4, _CInt_4, CFloat, _0>, @in_guaranteed glm.vec<_CInt_3, CFloat, _0>) -> glm.mat<_CInt_4, _CInt_4, CFloat, _0>>) // id: %204

bb12:                                             // Preds: bb10
  %205 = enum $Optional<@convention(c) (glm.mat<_CInt_4, _CInt_4, CFloat, _0>, glm.vec<_CInt_3, CFloat, _0>) -> glm.mat<_CInt_4, _CInt_4, CFloat, _0>>, #Optional.none!enumelt // user: %206
  br bb13(%205 : $Optional<@convention(c) (glm.mat<_CInt_4, _CInt_4, CFloat, _0>, glm.vec<_CInt_3, CFloat, _0>) -> glm.mat<_CInt_4, _CInt_4, CFloat, _0>>) // id: %206

// %207                                           // user: %208
bb13(%207 : $Optional<@convention(c) (glm.mat<_CInt_4, _CInt_4, CFloat, _0>, glm.vec<_CInt_3, CFloat, _0>) -> glm.mat<_CInt_4, _CInt_4, CFloat, _0>>): // Preds: bb12 bb11
  switch_enum %207 : $Optional<@convention(c) (glm.mat<_CInt_4, _CInt_4, CFloat, _0>, glm.vec<_CInt_3, CFloat, _0>) -> glm.mat<_CInt_4, _CInt_4, CFloat, _0>>, case #Optional.some!enumelt: bb15, case #Optional.none!enumelt: bb14 // id: %208

bb14:                                             // Preds: bb13
  %209 = string_literal utf8 "GLMSwiftDemo/main.swift" // user: %216
  %210 = integer_literal $Builtin.Word, 23        // user: %216
  %211 = integer_literal $Builtin.Int1, -1        // user: %216
  %212 = integer_literal $Builtin.Word, 12        // user: %216
  %213 = integer_literal $Builtin.Word, 27
  %214 = integer_literal $Builtin.Int1, -1        // user: %216
  // function_ref _diagnoseUnexpectedNilOptional(_filenameStart:_filenameLength:_filenameIsASCII:_line:_isImplicitUnwrap:)
  %215 = function_ref @$ss30_diagnoseUnexpectedNilOptional14_filenameStart01_E6Length01_E7IsASCII5_line17_isImplicitUnwrapyBp_BwBi1_BwBi1_tF : $@convention(thin) (Builtin.RawPointer, Builtin.Word, Builtin.Int1, Builtin.Word, Builtin.Int1) -> () // user: %216
  %216 = apply %215(%209, %210, %211, %212, %214) : $@convention(thin) (Builtin.RawPointer, Builtin.Word, Builtin.Int1, Builtin.Word, Builtin.Int1) -> ()
  unreachable                                     // id: %217

// %218                                           // user: %241
bb15(%218 : $@convention(c) (glm.mat<_CInt_4, _CInt_4, CFloat, _0>, glm.vec<_CInt_3, CFloat, _0>) -> glm.mat<_CInt_4, _CInt_4, CFloat, _0>): // Preds: bb13
  %219 = alloc_stack $glm.mat<_CInt_4, _CInt_4, CFloat, _0> // users: %243, %227, %226
  %220 = metatype $@thin glm.mat<_CInt_4, _CInt_4, CFloat, _0>.Type
  %221 = float_literal $Builtin.FPIEEE64, 0x3FF0000000000000 // 1 // user: %224
  %222 = metatype $@thin Float.Type               // user: %224
  // function_ref Float.init(_builtinFloatLiteral:)
  %223 = function_ref @$sSf20_builtinFloatLiteralSfBf64__tcfC : $@convention(method) (Builtin.FPIEEE64, @thin Float.Type) -> Float // user: %224
  %224 = apply %223(%221, %222) : $@convention(method) (Builtin.FPIEEE64, @thin Float.Type) -> Float // user: %226
  // function_ref ??0?$mat@$03$03M$0A@@glm@@QEAA@M@Z
  %225 = function_ref @??0?$mat@$03$03M$0A@@glm@@QEAA@M@Z : $@convention(c) (Float) -> @out glm.mat<_CInt_4, _CInt_4, CFloat, _0> // user: %226
  %226 = apply %225(%219, %224) : $@convention(c) (Float) -> @out glm.mat<_CInt_4, _CInt_4, CFloat, _0>
  %227 = load [trivial] %219 : $*glm.mat<_CInt_4, _CInt_4, CFloat, _0> // user: %241
  %228 = alloc_stack $glm.vec<_CInt_3, CFloat, _0> // users: %242, %240, %239
  %229 = metatype $@thin glm.vec<_CInt_3, CFloat, _0>.Type
  %230 = integer_literal $Builtin.IntLiteral, 0   // user: %233
  %231 = metatype $@thin Int.Type                 // user: %233
  // function_ref Int.init(_builtinIntegerLiteral:)
  %232 = function_ref @$sSi22_builtinIntegerLiteralSiBI_tcfC : $@convention(method) (Builtin.IntLiteral, @thin Int.Type) -> Int // user: %233
  %233 = apply %232(%230, %231) : $@convention(method) (Builtin.IntLiteral, @thin Int.Type) -> Int // user: %239
  %234 = integer_literal $Builtin.IntLiteral, 0   // user: %237
  %235 = metatype $@thin Int.Type                 // user: %237
  // function_ref Int.init(_builtinIntegerLiteral:)
  %236 = function_ref @$sSi22_builtinIntegerLiteralSiBI_tcfC : $@convention(method) (Builtin.IntLiteral, @thin Int.Type) -> Int // user: %237
  %237 = apply %236(%234, %235) : $@convention(method) (Builtin.IntLiteral, @thin Int.Type) -> Int // user: %239
  // function_ref ??$?0_J_JM@?$vec@$02M$0A@@glm@@QEAA@_J0M@Z
  %238 = function_ref @??$?0_J_JM@?$vec@$02M$0A@@glm@@QEAA@_J0M@Z : $@convention(c) (Int, Int, Float) -> @out glm.vec<_CInt_3, CFloat, _0> // user: %239
  %239 = apply %238(%228, %233, %237, %0) : $@convention(c) (Int, Int, Float) -> @out glm.vec<_CInt_3, CFloat, _0>
  %240 = load [trivial] %228 : $*glm.vec<_CInt_3, CFloat, _0> // user: %241
  %241 = apply %218(%227, %240) : $@convention(c) (glm.mat<_CInt_4, _CInt_4, CFloat, _0>, glm.vec<_CInt_3, CFloat, _0>) -> glm.mat<_CInt_4, _CInt_4, CFloat, _0> // user: %244
  dealloc_stack %228 : $*glm.vec<_CInt_3, CFloat, _0> // id: %242
  dealloc_stack %219 : $*glm.mat<_CInt_4, _CInt_4, CFloat, _0> // id: %243
  %244 = move_value [var_decl] %241 : $glm.mat<_CInt_4, _CInt_4, CFloat, _0> // users: %258, %245
  debug_value %244 : $glm.mat<_CInt_4, _CInt_4, CFloat, _0>, let, name "secondTranslate" // id: %245
  %246 = move_value [var_decl] %198 : $glm.mat<_CInt_4, _CInt_4, CFloat, _0> // users: %257, %255, %247
  debug_value %246 : $glm.mat<_CInt_4, _CInt_4, CFloat, _0>, let, name "model" // id: %247
  // function_ref * infix(_:_:)
  %248 = function_ref @$s18GLMSwiftExtensions1moiySo3glmO0045mat_CInt_4_CInt_4CFloat_0_JuFIihagGEaiahBAcGcVAF_AFtF : $@convention(thin) (glm.mat<_CInt_4, _CInt_4, CFloat, _0>, glm.mat<_CInt_4, _CInt_4, CFloat, _0>) -> glm.mat<_CInt_4, _CInt_4, CFloat, _0> // user: %249
  %249 = apply %248(%106, %157) : $@convention(thin) (glm.mat<_CInt_4, _CInt_4, CFloat, _0>, glm.mat<_CInt_4, _CInt_4, CFloat, _0>) -> glm.mat<_CInt_4, _CInt_4, CFloat, _0> // user: %250
  %250 = move_value [var_decl] %249 : $glm.mat<_CInt_4, _CInt_4, CFloat, _0> // users: %256, %253, %251
  debug_value %250 : $glm.mat<_CInt_4, _CInt_4, CFloat, _0>, let, name "view" // id: %251
  // function_ref * infix(_:_:)
  %252 = function_ref @$s18GLMSwiftExtensions1moiySo3glmO0045mat_CInt_4_CInt_4CFloat_0_JuFIihagGEaiahBAcGcVAF_AFtF : $@convention(thin) (glm.mat<_CInt_4, _CInt_4, CFloat, _0>, glm.mat<_CInt_4, _CInt_4, CFloat, _0>) -> glm.mat<_CInt_4, _CInt_4, CFloat, _0> // user: %253
  %253 = apply %252(%61, %250) : $@convention(thin) (glm.mat<_CInt_4, _CInt_4, CFloat, _0>, glm.mat<_CInt_4, _CInt_4, CFloat, _0>) -> glm.mat<_CInt_4, _CInt_4, CFloat, _0> // user: %255
  // function_ref * infix(_:_:)
  %254 = function_ref @$s18GLMSwiftExtensions1moiySo3glmO0045mat_CInt_4_CInt_4CFloat_0_JuFIihagGEaiahBAcGcVAF_AFtF : $@convention(thin) (glm.mat<_CInt_4, _CInt_4, CFloat, _0>, glm.mat<_CInt_4, _CInt_4, CFloat, _0>) -> glm.mat<_CInt_4, _CInt_4, CFloat, _0> // user: %255
  %255 = apply %254(%253, %246) : $@convention(thin) (glm.mat<_CInt_4, _CInt_4, CFloat, _0>, glm.mat<_CInt_4, _CInt_4, CFloat, _0>) -> glm.mat<_CInt_4, _CInt_4, CFloat, _0> // user: %263
  extend_lifetime %250 : $glm.mat<_CInt_4, _CInt_4, CFloat, _0> // id: %256
  extend_lifetime %246 : $glm.mat<_CInt_4, _CInt_4, CFloat, _0> // id: %257
  extend_lifetime %244 : $glm.mat<_CInt_4, _CInt_4, CFloat, _0> // id: %258
  extend_lifetime %198 : $glm.mat<_CInt_4, _CInt_4, CFloat, _0> // id: %259
  extend_lifetime %157 : $glm.mat<_CInt_4, _CInt_4, CFloat, _0> // id: %260
  extend_lifetime %106 : $glm.mat<_CInt_4, _CInt_4, CFloat, _0> // id: %261
  extend_lifetime %61 : $glm.mat<_CInt_4, _CInt_4, CFloat, _0> // id: %262
  return %255 : $glm.mat<_CInt_4, _CInt_4, CFloat, _0> // id: %263
} // end sil function '$s12GLMSwiftDemo22clipTransformFnPointer7cameraZ9rotationsSo3glmO0045mat_CInt_4_CInt_4CFloat_0_JuFIihagGEaiahBAcGcVSf_AF0034vec_CInt_3CFloat_0_JfAHfgaIvhGGajcVtF'

Please submit a bug report (https://swift.org/contributing/#reporting-bugs) and include the crash backtrace.
Stack dump:
0.      Program arguments: E:\\swift\\Toolchains\\6.1.2+Asserts\\usr\\bin\\swift-frontend.exe -frontend -c -primary-file E:\\Git\\glmSwift\\swift\\GLMSwiftDemo\\main.swift -emit-dependencies-path E:\\Git\\glmSwift\\.build\\x86_64-unknown-windows-msvc\\debug\\GLMSwiftDemo.build\\main.d -emit-reference-dependencies-path E:\\Git\\glmSwift\\.build\\x86_64-unknown-windows-msvc\\debug\\GLMSwiftDemo.build\\main.swiftdeps -target x86_64-unknown-windows-msvc -disable-objc-interop -cxx-interoperability-mode=default -sdk E:\\swift\\Platforms\\6.1.2\\Windows.platform\\Developer\\SDKs\\Windows.sdk\\ -I E:\\Git\\glmSwift\\.build\\x86_64-unknown-windows-msvc\\debug\\Modules -I E:\\swift\\Platforms\\6.1.2\\Windows.platform\\Developer\\Library\\XCTest-development\\usr\\lib\\swift\\windows -I E:\\swift\\Platforms\\6.1.2\\Windows.platform\\Developer\\Library\\XCTest-development\\usr\\lib\\swift\\windows\\x86_64 -I E:\\swift\\Platforms\\6.1.2\\Windows.platform\\Developer\\Library\\Testing-development\\usr\\lib\\swift\\windows -color-diagnostics -enable-testing -g -debug-info-format=dwarf -dwarf-version=4 -module-cache-path E:\\Git\\glmSwift\\.build\\x86_64-unknown-windows-msvc\\debug\\ModuleCache -static -swift-version 6 -Onone -D SWIFT_PACKAGE -D DEBUG -empty-abi-descriptor -resource-dir E:\\swift\\Toolchains\\6.1.2+Asserts\\usr\\lib\\swift -enable-anonymous-context-mangled-names -file-compilation-dir E:\\Git\\glmSwift -Xcc -fmodule-map-file=E:\\Git\\glmSwift\\.build\\x86_64-unknown-windows-msvc\\debug\\GLMSwift.build\\module.modulemap -Xcc -I -Xcc E:\\Git\\glmSwift\\swift\\GLMSwift\\Sources\\include -Xcc -D_MT -Xcc -D_DLL -Xcc -Xclang -Xcc 
--dependent-lib=msvcrt -Xcc -gdwarf -module-name GLMSwiftDemo -package-name glmswift -in-process-plugin-server-path E:\\swift\\Toolchains\\6.1.2+Asserts\\usr\\bin\\SwiftInProcPluginServer.dll -plugin-path E:\\swift\\Toolchains\\6.1.2+Asserts\\usr\\bin -plugin-path E:\\swift\\Toolchains\\6.1.2+Asserts\\usr\\local\\bin -parse-as-library -o E:\\Git\\glmSwift\\.build\\x86_64-unknown-windows-msvc\\debug\\GLMSwiftDemo.build\\main.swift.o -index-store-path E:\\Git\\glmSwift\\.build\\x86_64-unknown-windows-msvc\\debug\\index\\store -index-system-modules
1.      Swift version 6.1.2 (swift-6.1.2-RELEASE)
2.      Compiling with the current language version
3.      While evaluating request ASTLoweringRequest(Lowering AST to SIL for file "E:\Git\glmSwift\swift\GLMSwiftDemo\main.swift")
4.      While silgen emitFunction SIL function "@$s12GLMSwiftDemo22clipTransformFnPointer7cameraZ9rotationsSo3glmO0045mat_CInt_4_CInt_4CFloat_0_JuFIihagGEaiahBAcGcVSf_AF0034vec_CInt_3CFloat_0_JfAHfgaIvhGGajcVtF".
 for 'clipTransformFnPointer(cameraZ:rotations:)' (at E:\Git\glmSwift\swift\GLMSwiftDemo\main.swift:4:1)
5.      While verifying SIL function "@$s12GLMSwiftDemo22clipTransformFnPointer7cameraZ9rotationsSo3glmO0045mat_CInt_4_CInt_4CFloat_0_JuFIihagGEaiahBAcGcVSf_AF0034vec_CInt_3CFloat_0_JfAHfgaIvhGGajcVtF".
 for 'clipTransformFnPointer(cameraZ:rotations:)' (at E:\Git\glmSwift\swift\GLMSwiftDemo\main.swift:4:1)
Exception Code: 0x80000003
 #0 0x00007ff6162e7225 (E:\swift\Toolchains\6.1.2+Asserts\usr\bin\swift-frontend.exe+0x69e7225)
 #1 0x00007ffa92e41881 (C:\Windows\System32\ucrtbase.dll+0x71881)
 #2 0x00007ffa92e42851 (C:\Windows\System32\ucrtbase.dll+0x72851)
 #3 0x00007ff610f625ab (E:\swift\Toolchains\6.1.2+Asserts\usr\bin\swift-frontend.exe+0x16625ab)
 #4 0x00007ff610f4244e (E:\swift\Toolchains\6.1.2+Asserts\usr\bin\swift-frontend.exe+0x164244e)
 #5 0x00007ff610f6d6d8 (E:\swift\Toolchains\6.1.2+Asserts\usr\bin\swift-frontend.exe+0x166d6d8)
 #6 0x00007ff610f719cb (E:\swift\Toolchains\6.1.2+Asserts\usr\bin\swift-frontend.exe+0x16719cb)
 #7 0x00007ff610f7213f (E:\swift\Toolchains\6.1.2+Asserts\usr\bin\swift-frontend.exe+0x167213f)
 #8 0x00007ff610f626dc (E:\swift\Toolchains\6.1.2+Asserts\usr\bin\swift-frontend.exe+0x16626dc)
 #9 0x00007ff6105a7bb9 (E:\swift\Toolchains\6.1.2+Asserts\usr\bin\swift-frontend.exe+0xca7bb9)
#10 0x00007ff61059e610 (E:\swift\Toolchains\6.1.2+Asserts\usr\bin\swift-frontend.exe+0xc9e610)
#11 0x00007ff6105a133b (E:\swift\Toolchains\6.1.2+Asserts\usr\bin\swift-frontend.exe+0xca133b)
#12 0x00007ff6105a914e (E:\swift\Toolchains\6.1.2+Asserts\usr\bin\swift-frontend.exe+0xca914e)
#13 0x00007ff6105a1595 (E:\swift\Toolchains\6.1.2+Asserts\usr\bin\swift-frontend.exe+0xca1595)
#14 0x00007ff6105a1c76 (E:\swift\Toolchains\6.1.2+Asserts\usr\bin\swift-frontend.exe+0xca1c76)
#15 0x00007ff6105a93f6 (E:\swift\Toolchains\6.1.2+Asserts\usr\bin\swift-frontend.exe+0xca93f6)
#16 0x00007ff610598248 (E:\swift\Toolchains\6.1.2+Asserts\usr\bin\swift-frontend.exe+0xc98248)
#17 0x00007ff6105a78a4 (E:\swift\Toolchains\6.1.2+Asserts\usr\bin\swift-frontend.exe+0xca78a4)
#18 0x00007ff60fec0559 (E:\swift\Toolchains\6.1.2+Asserts\usr\bin\swift-frontend.exe+0x5c0559)
#19 0x00007ff60febf26c (E:\swift\Toolchains\6.1.2+Asserts\usr\bin\swift-frontend.exe+0x5bf26c)
#20 0x00007ff60febf7db (E:\swift\Toolchains\6.1.2+Asserts\usr\bin\swift-frontend.exe+0x5bf7db)
#21 0x00007ff60fec15bb (E:\swift\Toolchains\6.1.2+Asserts\usr\bin\swift-frontend.exe+0x5c15bb)
#22 0x00007ff60fd0f4f0 (E:\swift\Toolchains\6.1.2+Asserts\usr\bin\swift-frontend.exe+0x40f4f0)
#23 0x00007ff60fd0efa7 (E:\swift\Toolchains\6.1.2+Asserts\usr\bin\swift-frontend.exe+0x40efa7)
#24 0x00007ff6163462c0 (E:\swift\Toolchains\6.1.2+Asserts\usr\bin\swift-frontend.exe+0x6a462c0)
#25 0x00007ffa94ae7374 (C:\Windows\System32\KERNEL32.DLL+0x17374)
#26 0x00007ffa951dcc91 (C:\Windows\SYSTEM32\ntdll.dll+0x4cc91)
PS E:\Git\glmSwift>

Expected behavior

Not to crash;

Environment

Swift version 6.1.2 (swift-6.1.2-RELEASE)
Target: x86_64-unknown-windows-msvc

Additional information

If I leave just one call per function pointer it all compiles well and works as expected, I get the rotation translation and scale that I want.
But there are no issues with multiple calls to pi_f32() . I'm guessing it's because it's return type is simple.

Metadata

Metadata

Assignees

Labels

bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.c++ interopFeature: Interoperability with C++crashBug: A crash, i.e., an abnormal termination of software

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions