mirror of
https://github.com/pezkuwichain/revive.git
synced 2026-06-16 02:41:05 +00:00
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:
@@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user