mirror of
https://github.com/mii443/wasmer.git
synced 2025-08-31 04:39:28 +00:00
Canonicalize floats before branch, in Operator::Return too.
This commit is contained in:
@ -1723,12 +1723,13 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> {
|
|||||||
.ok_or_else(|| CompileError::Codegen("not currently in a block".to_string()))?;
|
.ok_or_else(|| CompileError::Codegen("not currently in a block".to_string()))?;
|
||||||
|
|
||||||
let frame = self.state.outermost_frame()?;
|
let frame = self.state.outermost_frame()?;
|
||||||
self.builder.build_unconditional_branch(*frame.br_dest());
|
|
||||||
for phi in frame.phis().to_vec().iter().rev() {
|
for phi in frame.phis().to_vec().iter().rev() {
|
||||||
let (arg, info) = self.state.pop1_extra()?;
|
let (arg, info) = self.state.pop1_extra()?;
|
||||||
let arg = self.apply_pending_canonicalization(arg, info);
|
let arg = self.apply_pending_canonicalization(arg, info);
|
||||||
phi.add_incoming(&[(&arg, current_block)]);
|
phi.add_incoming(&[(&arg, current_block)]);
|
||||||
}
|
}
|
||||||
|
let frame = self.state.outermost_frame()?;
|
||||||
|
self.builder.build_unconditional_branch(*frame.br_dest());
|
||||||
|
|
||||||
self.state.reachable = false;
|
self.state.reachable = false;
|
||||||
}
|
}
|
||||||
|
@ -193,7 +193,7 @@
|
|||||||
(assert_return (invoke "nan-canonicalization-f64-func-call-indirect" (i64.const 0x7ff8000000000001)) (i64.const 0x7ff8000000000001))
|
(assert_return (invoke "nan-canonicalization-f64-func-call-indirect" (i64.const 0x7ff8000000000001)) (i64.const 0x7ff8000000000001))
|
||||||
(assert_return (invoke "nan-canonicalization-f64-func-call-indirect-cncl" (i64.const 0x7ff8000000000001)) (i64.const 0x7ff8000000000000))
|
(assert_return (invoke "nan-canonicalization-f64-func-call-indirect-cncl" (i64.const 0x7ff8000000000001)) (i64.const 0x7ff8000000000000))
|
||||||
|
|
||||||
;; Test canonicalization is done before `else` operator.
|
;; Test canonicalization is done before branch in `else` operator.
|
||||||
(module
|
(module
|
||||||
(func (;0;)
|
(func (;0;)
|
||||||
(local f64)
|
(local f64)
|
||||||
@ -208,3 +208,14 @@
|
|||||||
return
|
return
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
;; Test canonicalization is done before branch in `return` operator.
|
||||||
|
(module
|
||||||
|
(func (;0;) (result f64)
|
||||||
|
(local f64)
|
||||||
|
f64.const 0x0p+0
|
||||||
|
local.get 0
|
||||||
|
f64.mul
|
||||||
|
return
|
||||||
|
)
|
||||||
|
)
|
||||||
|
Reference in New Issue
Block a user