Strip minsize attribute from functions with large div/rem (#390)

That's a workaround to avoid LLVM backend crash while selecting
instruction for 256-bit integer division.
The workaround needs to be removed after we switch to newest inkwell
that has a fix in RISC-V backend

---------

Signed-off-by: kvp <mammal_windier8j@icloud.com>
This commit is contained in:
kvpanch
2025-10-21 04:35:40 -04:00
committed by GitHub
parent f46bea6a96
commit 6549a4f825
4 changed files with 116 additions and 1 deletions
@@ -0,0 +1,41 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8;
contract LargeDivRem {
function rem_2(int n) public pure returns (int q) {
assembly {
q := smod(n, 2)
}
}
function div_2(int n) public pure returns (int q) {
assembly {
q := sdiv(n, 2)
}
}
function rem_7(int n) public pure returns (int q) {
assembly {
q := smod(n, 7)
}
}
function div_7(int n) public pure returns (int q) {
assembly {
q := sdiv(n, 2)
}
}
function rem_k(int n, int k) public pure returns (int q) {
assembly {
q := smod(n, k)
}
}
function div_k(int n, int k) public pure returns (int q) {
assembly {
q := sdiv(n, k)
}
}
}