Index: src/compiler/wasm-compiler.cc |
diff --git a/src/compiler/wasm-compiler.cc b/src/compiler/wasm-compiler.cc |
index 17065d61b4aac0b34adefab2a945af092250b159..efcf9248e579766918143cdee77ee28c4e6cc96e 100644 |
--- a/src/compiler/wasm-compiler.cc |
+++ b/src/compiler/wasm-compiler.cc |
@@ -1121,14 +1121,12 @@ Node* WasmGraphBuilder::BuildI32SConvertF32(Node* input) { |
MachineOperatorBuilder* m = jsgraph()->machine(); |
// Truncation of the input value is needed for the overflow check later. |
Node* trunc = Unop(wasm::kExprF32Trunc, input); |
- // TODO(titzer): two conversions |
- Node* f64_trunc = graph()->NewNode(m->ChangeFloat32ToFloat64(), trunc); |
- Node* result = graph()->NewNode(m->ChangeFloat64ToInt32(), f64_trunc); |
+ Node* result = graph()->NewNode(m->TruncateFloat32ToInt32(), trunc); |
// Convert the result back to f64. If we end up at a different value than the |
// truncated input value, then there has been an overflow and we trap. |
- Node* check = Unop(wasm::kExprF64SConvertI32, result); |
- Node* overflow = Binop(wasm::kExprF64Ne, f64_trunc, check); |
+ Node* check = Unop(wasm::kExprF32SConvertI32, result); |
+ Node* overflow = Binop(wasm::kExprF32Ne, trunc, check); |
trap_->AddTrapIfTrue(kTrapFloatUnrepresentable, overflow); |
return result; |