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
+25 -1
View File
@@ -2,7 +2,8 @@
use crate::tests::cli::utils::{
self, assert_command_failure, assert_command_success, assert_equal_exit_codes, execute_resolc,
execute_solc, RESOLC_YUL_FLAG, SOLIDITY_CONTRACT_PATH, YUL_MEMSET_CONTRACT_PATH,
execute_solc, RESOLC_YUL_FLAG, SOLIDITY_CONTRACT_PATH, SOLIDITY_LARGE_DIV_REM_CONTRACT_PATH,
YUL_MEMSET_CONTRACT_PATH,
};
const LEVELS: &[char] = &['0', '1', '2', '3', 's', 'z'];
@@ -56,3 +57,26 @@ fn disable_solc_optimzer() {
assert_ne!(enabled.stdout, disabled.stdout);
}
#[test]
fn test_large_div_rem_expansion() {
for level in LEVELS {
let optimization_argument = format!("-O{level}");
let arguments = &[SOLIDITY_LARGE_DIV_REM_CONTRACT_PATH, &optimization_argument];
let resolc_result = utils::execute_resolc(arguments);
assert!(
resolc_result.success,
"Providing the level `{optimization_argument}` should succeed with exit code {}, got {}.\nDetails: {}",
revive_common::EXIT_CODE_SUCCESS,
resolc_result.code,
resolc_result.stderr
);
assert!(
resolc_result
.stderr
.contains("Compiler run successful. No output requested"),
"Expected the output to contain a success message when providing the level `{optimization_argument}`."
);
}
}