mirror of
https://github.com/bytecodealliance/wasm-micro-runtime.git
synced 2025-02-06 23:15:16 +00:00
Fix aot rotl/rotr 0 issue (#1285)
Fix the issue reported in #1282. When i32/i64 rotate (rotl/rotr) with 0, the LLVM IRs translated are: left<<0 | left>>64 and left >>0 | left<<64 The value of left >> 64 and left <<64 in LLVM are treated as poison, which causes invalid result when executing the aot function. Directly return left when right is 0 to fix the issue.
This commit is contained in:
parent
0f6e5a55a4
commit
177aa4fc79
|
@ -692,6 +692,10 @@ compile_int_rot(AOTCompContext *comp_ctx, LLVMValueRef left, LLVMValueRef right,
|
|||
|
||||
SHIFT_COUNT_MASK;
|
||||
|
||||
/* rotl/rotr with 0 */
|
||||
if (IS_CONST_ZERO(right))
|
||||
return left;
|
||||
|
||||
/* Calculate (bits - shif_count) */
|
||||
LLVM_BUILD_OP(Sub, is_i32 ? I32_32 : I64_64, right, bits_minus_shift_count,
|
||||
"bits_minus_shift_count", NULL);
|
||||
|
|
Loading…
Reference in New Issue
Block a user