Skip to content

Commit 2354212

Browse files
committed
fix: resolve Cranelift IR verification errors for extern function signatures
Three issues caused 46 functions to be skipped during compilation: 1. Return type mismatches: Return values weren't coerced to match the function signature's declared types. All three Return terminator handlers now use coerce_value, and bare returns (0 values when signature expects N) are padded with zero values. 2. Cross-size int/float coercion: coerce_value only handled same-size bitcasts. Added fcvt_from_sint for int->float and fcvt_to_sint_sat for float->int with different bit widths. 3. Extern 0-param placeholders: Import resolution created HirFunctions with empty param lists for ZRTL symbols. Added prescan_extern_call_sites to infer correct param types from call sites before declaration, and fall back to ZRTL plugin signatures when available. Duplicate symbol declarations (e.g. tensor_sqrt and $Tensor$sqrt) reuse existing FuncIds. Reduces CRANELIFT WARN from 46 to 4 (remaining are legitimate ZRTL API mismatches needing List-unpacking wrappers in tensor.zynml).
1 parent 283d187 commit 2354212

1 file changed

Lines changed: 280 additions & 39 deletions

File tree

0 commit comments

Comments
 (0)