Why aren't you just using SILBuilderWithLocation() ?
Where can I find SILBuilderWithLocation
? The only reference I found is SILBuilder ergonomics for improved debug scope handling.
The synthesized code is related to a return statement?
The test case is:
@inline(never)
func foo() -> Int32? {
return 0
}
func getLogpLex() {
if let _ = foo() {
_ = Tensor<Float>(1.0)
return
} else {
// For the SILLocation associated with this return stmt/inst,
// The LocationKind is ReturnKind.
//
// When we synthesize host code to send case id #1 to the accelerator, make
// sure the host inst will NOT use ReturnKind as the LocationKind.
return
}
}
public func b118507040() {
getLogpLex()
_ = Tensor<Float>(1.0)
}
We first inline getLogpLex()
into b118507040()
, and then synthesize some code for b118507040()
, at the location of the second return (the else body) of getLogpLex()
. So after inlining, that SIL instruction is not a return inst any more, but its SILLocation::LocationKind is still set to ReturnKind.
I wonder if the inliner should change the LocationKind from ReturnKind to RegularKind in that case?