SIGN IN SIGN UP

[wasm2js] Support nontrapping float-to-int conversions directly in JS (#9019)

Now that 64-bit `trunc_sat` instructions are supported directly in
`I64ToI32Lowering` (#9017), and 32-bit `trunc_sat` instructions are
handled directly in `wasm2js` (`~~expr` and `~~expr >>> 0`), we no
longer need to run `llvm-nontrapping-fptoint-lowering` when
`--emscripten` is passed.

In `wasm2js`, trapping float-to-int operations (`i32.trunc_*` and
`i64.trunc_*`) are already lowered to non-trapping JS conversions
(`~~expr` and float arithmetic in `I64ToI32Lowering`), which do not trap
on out-of-range values or NaN/Infinity (matching C/C++ UB semantics
rather than strict Wasm trapping semantics).

Removing `llvm-nontrapping-fptoint-lowering` extends that same direct
approach to `trunc_sat` instructions under `--emscripten`, eliminating
branching overhead and reducing code size.

Finally, add a commit to `LLVMNontrappingFPToIntLowering.cpp` about it
have no known users after this change.
S
Sam Clegg committed
bb0caa3fc547e1281391b1235c93f1ed84541c2e
Parent: f0fd896
Committed by GitHub <noreply@github.com> on 8/22/2026, 1:09:03 AM