[i64-to-i32-lowering] Lower nontrapping float-to-int conversions (#9017)
Add support for `TruncSatSFloat32ToInt64`, `TruncSatUFloat32ToInt64`, `TruncSatSFloat64ToInt64`, and `TruncSatUFloat64ToInt64` to `I64ToI32Lowering.cpp`. In Emscripten mode (`wasm2js --emscripten`), this is effectively a no-op because `llvm-nontrapping-fptoint-lowering` runs earlier in the pipeline and rewrites all `TruncSat` operations into trapping conversions before `i64-to-i32-lowering` executes. However, landing this is still useful because: 1. Standalone `wasm2js` (without `--emscripten`) does not run `llvm-nontrapping-fptoint-lowering`, so modules with `i64.trunc_sat_*` instructions would otherwise fail during JS generation. 2. Direct invocations of `wasm-opt --flatten --i64-to-i32-lowering` will now correctly eliminate all 64-bit operations on modules using the nontrapping float-to-int feature. 3. It ensures `I64ToI32Lowering` is self-contained and handles all wasm i64-producing float truncation opcodes without relying on preceding lowering passes. 4. Since we removed the use of the `nontrapping-fptoint-lowering` pass in emscripten itself, I'm hoping we can followup by removing its use here too and marking it for removal.
S
Sam Clegg committed
0af42fada13d92687f4890276da1a66b8af69483
Parent: 1dbc251
Committed by GitHub <noreply@github.com>
on 8/20/2026, 6:51:15 PM