fix(cranelift): correct sign extension operators to use ireduce result#12609
fix(cranelift): correct sign extension operators to use ireduce result#12609radik878 wants to merge 1 commit intobytecodealliance:mainfrom
Conversation
|
@radik878 I don't think your description is correct. The existing code pops, reduces, pushes; then pops, sign-extends, and pushes. The intermediate push-then-pop has the effect of carrying through the result of the reduce to the sign-extend. Nothing is discarded, and the "next value on the stack" is not used. I didn't write this code so I don't know the intent for sure but I can imagine this is meant to express the operator as a composition of the two operations. It's a little odd, but it's not incorrect. Your description ("fix") implies that you observed an incorrect execution. Did you, and if so can you show the test case here? And can you explain your reasoning a bit more? |
|
No response after ten days about whether an actual issue was observed, and the description and understanding of code is incorrect I believe -- will go ahead and close. |
What was wrong: The sign extension operators (
i32.extend8_s,i32.extend16_s,i64.extend8_s,i64.extend16_s,i64.extend32_s) were incorrectly discarding theireduceresult. The code was pushing theireduceresult to the value stack and then immediately popping a different value (the next value on the stack) for thesextendoperation.Changes: Store the
ireduceresult in a local variable and use it directly insextendinstead of popping from the stack.