-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix large literals #323
Fix large literals #323
Conversation
See the diff generated by this PR for the tests here: https://github.com/lifting-bits/rellic/actions/runs/4957976082 fizzbuzz.bctypedefs_of_typedefs.bcswitch_loop.bcfunc_cond_zero_arg.bcfcmp.bcconflicting_names.bcstruct.bcissue_183_literal_structs.bczeroinit.bcissue_127_uint128_t_lit.bc--- /dev/fd/63 2023-05-12 10:50:16.907968319 +0000
+++ /dev/fd/62 2023-05-12 10:50:16.907968319 +0000
@@ -1,9 +1,9 @@
int main(void);
-unsigned __int128 x = (unsigned __int128)3735928559ULL;
+unsigned __int128 x = (unsigned __int128)(unsigned __int128)(unsigned __int128)3735928559UL;
int main(void) {
unsigned int var0;
unsigned char val1;
var0 = 0U;
- val1 = (x & (unsigned __int128)65535ULL) == (unsigned __int128)48879ULL;
+ val1 = (x & (unsigned __int128)(unsigned __int128)65535UL) == (unsigned __int128)(unsigned __int128)48879UL;
return val1 ? 0U : 1U;
} global_using_function_decl.bcinit_list.bcreg_test_structure_fields.bcret0.bcgoto_loop.bc--- /dev/fd/63 2023-05-12 10:50:17.251968524 +0000
+++ /dev/fd/62 2023-05-12 10:50:17.251968524 +0000
@@ -6,7 +6,7 @@
unsigned int var1;
var0 = 0U;
var1 = 0U;
- while (1U)
+ while (1Ui8)
{
var1 = var1 + 1U;
if (var1 == 1U) { trunc.bcbitops.bccast.bcnullptr.bcnested_struct.bc--- /dev/fd/63 2023-05-12 10:50:18.031968988 +0000
+++ /dev/fd/62 2023-05-12 10:50:18.031968988 +0000
@@ -14,7 +14,7 @@
struct struct__pair field1;
struct struct__person field2;
};
-struct struct__record r1 = {14U, {33U, 42U}, {"Bob", (unsigned char)66U}};
+struct struct__record r1 = {14U, {33U, 42U}, {"Bob", 66Ui8}};
char _str_1[9] = "Name: %s\000";
int main(void) {
unsigned int var0; array_swap.bcbinops.bcbitmask.bcloop.bcfloat.bcnested_while.bcvectors.bcfuncptr.bcstruct_swap.bcshort.bc--- /dev/fd/63 2023-05-12 10:50:19.879970070 +0000
+++ /dev/fd/62 2023-05-12 10:50:19.879970070 +0000
@@ -1,10 +1,10 @@
int main(void);
-unsigned short a = (unsigned short)0U;
+unsigned short a = (unsigned short)0Ui16;
int main(void) {
unsigned int var0;
unsigned short var1;
var0 = 0U;
- a = 13U;
+ a = 13Ui16;
var1 = a;
return (unsigned int)var1;
} inttoptr.bcissue_4.bcissue_123_uint128_t.bcfizzbuzz_stateful.bcissue_94_strncmp.bcbool.bczext.bc--- /dev/fd/63 2023-05-12 10:50:21.195970822 +0000
+++ /dev/fd/62 2023-05-12 10:50:21.195970822 +0000
@@ -1,5 +1,5 @@
int main(void);
-char a = (unsigned char)1U;
+char a = (unsigned char)1Ui8;
int main(void) {
unsigned int var0;
var0 = 0U; byval_struct.bcfunc_cond_two_arg.bcconflicting_global.bcassert.bcswitch.bcbranch.bctemplate_parameter_pack.bcbyval_tail_nogep.llbyval_tail_gep.ll |
See the diff generated by this PR for the tests here: https://github.com/lifting-bits/rellic/actions/runs/4959022548 fizzbuzz.bctypedefs_of_typedefs.bcswitch_loop.bcfunc_cond_zero_arg.bcfcmp.bcconflicting_names.bcstruct.bcissue_183_literal_structs.bczeroinit.bcissue_127_uint128_t_lit.bc--- /dev/fd/63 2023-05-12 12:53:50.918157142 +0000
+++ /dev/fd/62 2023-05-12 12:53:50.918157142 +0000
@@ -1,9 +1,9 @@
int main(void);
-unsigned __int128 x = (unsigned __int128)3735928559ULL;
+unsigned __int128 x = (unsigned __int128)3735928559UL;
int main(void) {
unsigned int var0;
unsigned char val1;
var0 = 0U;
- val1 = (x & (unsigned __int128)65535ULL) == (unsigned __int128)48879ULL;
+ val1 = (x & (unsigned __int128)(unsigned long long)65535UL) == (unsigned __int128)(unsigned long long)48879UL;
return val1 ? 0U : 1U;
} global_using_function_decl.bcinit_list.bcreg_test_structure_fields.bcret0.bcgoto_loop.bctrunc.bcbitops.bccast.bcnullptr.bcnested_struct.bcarray_swap.bcbinops.bcbitmask.bcloop.bcfloat.bcnested_while.bc--- /dev/fd/63 2023-05-12 12:53:53.098225556 +0000
+++ /dev/fd/62 2023-05-12 12:53:53.098225556 +0000
@@ -25,7 +25,7 @@
printf("loop2 x: %d\n", var1);
}
}
- if (((int)var1 >= 20 || (int)var1 <= 10) && (int)var1 >= 20) {
+ if ((int)var1 >= 20 && ((int)var1 >= 20 || (int)var1 <= 10)) {
return var0;
}
} vectors.bcfuncptr.bcstruct_swap.bcshort.bcinttoptr.bcissue_4.bcissue_123_uint128_t.bcfizzbuzz_stateful.bcissue_94_strncmp.bcbool.bczext.bcbyval_struct.bcfunc_cond_two_arg.bcconflicting_global.bcassert.bcswitch.bcbranch.bctemplate_parameter_pack.bcbyval_tail_nogep.llbyval_tail_gep.ll |
86a933f
to
9873893
Compare
See the diff generated by this PR for the tests here: https://github.com/lifting-bits/rellic/actions/runs/5014381562 fizzbuzz.bctypedefs_of_typedefs.bcswitch_loop.bcfunc_cond_zero_arg.bcfcmp.bcconflicting_names.bcstruct.bcissue_183_literal_structs.bczeroinit.bcissue_127_uint128_t_lit.bc--- /dev/fd/63 2023-05-18 13:29:15.928137986 +0000
+++ /dev/fd/62 2023-05-18 13:29:15.928137986 +0000
@@ -1,9 +1,9 @@
int main(void);
-unsigned __int128 x = (unsigned __int128)3735928559ULL;
+unsigned __int128 x = 3735928559;
int main(void) {
unsigned int var0;
unsigned char val1;
var0 = 0U;
- val1 = (x & (unsigned __int128)65535ULL) == (unsigned __int128)48879ULL;
+ val1 = (x & 65535) == 48879;
return val1 ? 0U : 1U;
} global_using_function_decl.bcinit_list.bcreg_test_structure_fields.bcret0.bcgoto_loop.bctrunc.bcbitops.bccast.bcnullptr.bcnested_struct.bc--- /dev/fd/63 2023-05-18 13:29:17.052170352 +0000
+++ /dev/fd/62 2023-05-18 13:29:17.052170352 +0000
@@ -14,7 +14,7 @@
struct struct__pair field1;
struct struct__person field2;
};
-struct struct__record r1 = {14U, {33U, 42U}, {"Bob", (unsigned char)66U}};
+struct struct__record r1 = {14U, {33U, 42U}, {"Bob", 66U}};
char _str_1[9] = "Name: %s\000";
int main(void) {
unsigned int var0; array_swap.bcbinops.bcbitmask.bcloop.bcfloat.bcnested_while.bc--- /dev/fd/63 2023-05-18 13:29:18.096200414 +0000
+++ /dev/fd/62 2023-05-18 13:29:18.096200414 +0000
@@ -25,7 +25,7 @@
printf("loop2 x: %d\n", var1);
}
}
- if (((int)var1 >= 20 || (int)var1 <= 10) && (int)var1 >= 20) {
+ if ((int)var1 >= 20 && ((int)var1 >= 20 || (int)var1 <= 10)) {
return var0;
}
} vectors.bcfuncptr.bcstruct_swap.bcshort.bc--- /dev/fd/63 2023-05-18 13:29:18.844221952 +0000
+++ /dev/fd/62 2023-05-18 13:29:18.844221952 +0000
@@ -1,5 +1,5 @@
int main(void);
-unsigned short a = (unsigned short)0U;
+unsigned short a = 0U;
int main(void) {
unsigned int var0;
unsigned short var1; inttoptr.bcissue_4.bcissue_123_uint128_t.bcfizzbuzz_stateful.bcissue_94_strncmp.bcbool.bczext.bc--- /dev/fd/63 2023-05-18 13:29:20.112258464 +0000
+++ /dev/fd/62 2023-05-18 13:29:20.112258464 +0000
@@ -1,5 +1,5 @@
int main(void);
-char a = (unsigned char)1U;
+char a = 1U;
int main(void) {
unsigned int var0;
var0 = 0U; byval_struct.bcfunc_cond_two_arg.bcconflicting_global.bcassert.bcswitch.bcbranch.bctemplate_parameter_pack.bcbyval_tail_nogep.llbyval_tail_gep.ll |
Since LLVM16 supports (u)int128 literals, there is no more need to emit adjusted literals |
9873893
to
8930adf
Compare
See the diff generated by this PR for the tests here: https://github.com/lifting-bits/rellic/actions/runs/8881669823 fizzbuzz.bctypedefs_of_typedefs.bcswitch_loop.bcfunc_cond_zero_arg.bcfcmp.bcconflicting_names.bcstruct.bcissue_183_literal_structs.bczeroinit.bcissue_127_uint128_t_lit.bc--- /dev/fd/63 2024-04-29 16:15:17.026959824 +0000
+++ /dev/fd/62 2024-04-29 16:15:17.026959824 +0000
@@ -1,9 +1,9 @@
int main(void);
-unsigned __int128 x = (unsigned __int128)3735928559ULL;
+unsigned __int128 x = 3735928559;
int main(void) {
unsigned int var0;
unsigned char val1;
var0 = 0U;
- val1 = (x & (unsigned __int128)65535ULL) == (unsigned __int128)48879ULL;
+ val1 = (x & 65535) == 48879;
return val1 ? 0U : 1U;
} struct_swap.bcglobal_using_function_decl.bcinit_list.bcret0.bcgoto_loop.bctrunc.bcbitops.bccast.bcnullptr.bcnested_struct.bc--- /dev/fd/63 2024-04-29 16:15:17.854970339 +0000
+++ /dev/fd/62 2024-04-29 16:15:17.854970339 +0000
@@ -14,7 +14,7 @@
struct struct__pair field1;
struct struct__person field2;
};
-struct struct__record r1 = {14U, {33U, 42U}, {"Bob", (unsigned char)66U}};
+struct struct__record r1 = {14U, {33U, 42U}, {"Bob", 66U}};
char _str_1[9] = "Name: %s\000";
int main(void) {
unsigned int var0; array_swap.bcbinops.bcbitmask.bcloop.bcfloat.bcreg_test_structure_fields.bcvectors.bcfuncptr.bcinttoptr.bcshort.bc--- /dev/fd/63 2024-04-29 16:15:18.850982987 +0000
+++ /dev/fd/62 2024-04-29 16:15:18.850982987 +0000
@@ -1,5 +1,5 @@
int main(void);
-unsigned short a = (unsigned short)0U;
+unsigned short a = 0U;
int main(void) {
unsigned int var0;
unsigned short var1; issue_4.bcconflicting_global.bcissue_123_uint128_t.bcfizzbuzz_stateful.bcissue_94_strncmp.bcbool.bczext.bc--- /dev/fd/63 2024-04-29 16:15:19.642993045 +0000
+++ /dev/fd/62 2024-04-29 16:15:19.642993045 +0000
@@ -1,5 +1,5 @@
int main(void);
-char a = (unsigned char)1U;
+char a = 1U;
int main(void) {
unsigned int var0;
var0 = 0U; byval_struct.bcnested_while.bc--- /dev/fd/63 2024-04-29 16:15:19.778994772 +0000
+++ /dev/fd/62 2024-04-29 16:15:19.778994772 +0000
@@ -25,7 +25,7 @@
printf("loop2 x: %d\n", var1);
}
}
- if (((int)var1 >= 20 || (int)var1 <= 10) && (int)var1 >= 20) {
+ if ((int)var1 >= 20 && ((int)var1 >= 20 || (int)var1 <= 10)) {
return var0;
}
} func_cond_two_arg.bcassert.bcswitch.bcbranch.bctemplate_parameter_pack.bcbyval_tail_nogep.llbyval_tail_gep.llissue_335_z3_ite.ll |
No description provided.