-
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
Bring ast_unit
, ast_ctx
, ast
into dec_ctx
#303
Conversation
See the diff generated by this PR for the tests here: https://github.com/lifting-bits/rellic/actions/runs/3089130199 fizzbuzz.bctypedefs_of_typedefs.bcswitch_loop.bcfunc_cond_zero_arg.bcfcmp.bcconflicting_names.bcstruct.bcissue_183_literal_structs.bcissue_127_uint128_t_lit.bcglobal_using_function_decl.bcshort.bcinit_list.bcreg_test_structure_fields.bcret0.bcgoto_loop.bctrunc.bcbitops.bccast.bcnullptr.bcnested_struct.bcarray_swap.bcbitmask.bcbinops.bcfloat.bcnested_while.bczeroinit.bcfuncptr.bcstruct_swap.bcbranch.bcvectors.bcissue_4.bcconflicting_global.bcissue_123_uint128_t.bcfizzbuzz_stateful.bcissue_94_strncmp.bcbool.bczext.bcbyval_struct.bcfunc_cond_two_arg.bcinttoptr.bcassert.bcloop.bcswitch.bctemplate_parameter_pack.bcbyval_tail_gep.llbyval_tail_nogep.ll |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a small nitpick. In cases like IRToASTVisitor
and I think GenerateAST
, where there are functions that used ast
a lot, it's probably a good idea to do something like auto ast = dec_ctx.ast;
rather than doing a plain search and replace and generating a huge diff and also longer expressions 👀
See the diff generated by this PR for the tests here: https://github.com/lifting-bits/rellic/actions/runs/3126650618 fizzbuzz.bc--- /dev/fd/63 2022-09-26 09:40:15.593380993 +0000
+++ /dev/fd/62 2022-09-26 09:40:15.593380993 +0000
@@ -11,14 +11,15 @@
var1 = 0U;
while ((int)var1 < 30)
{
- if ((int)var1 % 3 != 0U || !((int)var1 % 3 != 0U || (int)var1 % 5 == 0U)) {
- if ((int)var1 % 3 != 0U) {
+ if ((int)var1 % 3 != 0U || !((int)var1 % 5 == 0U || (int)var1 % 3 != 0U)) {
+ if ((int)var1 % 3 != 0U && ((int)var1 % 3 != 0U || (int)var1 % 5 != 0U)) {
if ((int)var1 % 5 != 0U) {
printf("%d\n", var1);
} else {
printf("buzz\n");
}
- } else {
+ }
+ if ((int)var1 % 3 == 0U && ((int)var1 % 3 != 0U || (int)var1 % 5 != 0U)) {
printf("fizz\n");
}
} else { typedefs_of_typedefs.bcswitch_loop.bcfunc_cond_zero_arg.bcfcmp.bcconflicting_names.bcstruct.bcissue_183_literal_structs.bcissue_127_uint128_t_lit.bcglobal_using_function_decl.bcshort.bcinit_list.bcreg_test_structure_fields.bcret0.bcgoto_loop.bctrunc.bcbitops.bccast.bcnullptr.bcnested_struct.bcarray_swap.bcbitmask.bcbinops.bcfloat.bcnested_while.bc--- /dev/fd/63 2022-09-26 09:40:18.861330210 +0000
+++ /dev/fd/62 2022-09-26 09:40:18.861330210 +0000
@@ -18,14 +18,14 @@
printf("loop1 x: %d\n", var1);
}
}
- if ((int)var1 <= 10 || (int)var1 >= 20) {
+ if ((int)var1 >= 20 || (int)var1 <= 10) {
while ((int)var1 < 20)
{
var1 = var1 + 1U;
printf("loop2 x: %d\n", var1);
}
}
- if ((int)var1 >= 20 && ((int)var1 <= 10 || (int)var1 >= 20)) {
+ if (((int)var1 >= 20 || (int)var1 <= 10) && (int)var1 >= 20) {
return var0;
}
} zeroinit.bcfuncptr.bcstruct_swap.bcbranch.bcvectors.bcissue_4.bcconflicting_global.bcissue_123_uint128_t.bcfizzbuzz_stateful.bcissue_94_strncmp.bcbool.bczext.bcbyval_struct.bcfunc_cond_two_arg.bcinttoptr.bcassert.bcloop.bcswitch.bctemplate_parameter_pack.bcbyval_tail_gep.llbyval_tail_nogep.ll |
See the diff generated by this PR for the tests here: https://github.com/lifting-bits/rellic/actions/runs/3126699465 fizzbuzz.bc--- /dev/fd/63 2022-09-26 09:47:30.138880285 +0000
+++ /dev/fd/62 2022-09-26 09:47:30.138880285 +0000
@@ -11,7 +11,7 @@
var1 = 0U;
while ((int)var1 < 30)
{
- if ((int)var1 % 3 != 0U || !((int)var1 % 3 != 0U || (int)var1 % 5 == 0U)) {
+ if ((int)var1 % 3 != 0U || !((int)var1 % 5 == 0U || (int)var1 % 3 != 0U)) {
if ((int)var1 % 3 != 0U) {
if ((int)var1 % 5 != 0U) {
printf("%d\n", var1); typedefs_of_typedefs.bcswitch_loop.bcfunc_cond_zero_arg.bcfcmp.bcconflicting_names.bcstruct.bcissue_183_literal_structs.bcissue_127_uint128_t_lit.bcglobal_using_function_decl.bcshort.bcinit_list.bcreg_test_structure_fields.bcret0.bcgoto_loop.bctrunc.bcbitops.bccast.bcnullptr.bcnested_struct.bcarray_swap.bcbitmask.bcbinops.bcfloat.bcnested_while.bczeroinit.bcfuncptr.bcstruct_swap.bcbranch.bcvectors.bcissue_4.bcconflicting_global.bcissue_123_uint128_t.bcfizzbuzz_stateful.bcissue_94_strncmp.bcbool.bczext.bcbyval_struct.bcfunc_cond_two_arg.bcinttoptr.bcassert.bcloop.bcswitch.bctemplate_parameter_pack.bcbyval_tail_gep.llbyval_tail_nogep.ll |
See the diff generated by this PR for the tests here: https://github.com/lifting-bits/rellic/actions/runs/3126719012 fizzbuzz.bc--- /dev/fd/63 2022-09-26 09:50:41.247001929 +0000
+++ /dev/fd/62 2022-09-26 09:50:41.247001929 +0000
@@ -11,7 +11,7 @@
var1 = 0U;
while ((int)var1 < 30)
{
- if ((int)var1 % 3 != 0U || !((int)var1 % 3 != 0U || (int)var1 % 5 == 0U)) {
+ if ((int)var1 % 3 != 0U || !((int)var1 % 5 == 0U || (int)var1 % 3 != 0U)) {
if ((int)var1 % 3 != 0U) {
if ((int)var1 % 5 != 0U) {
printf("%d\n", var1); typedefs_of_typedefs.bcswitch_loop.bcfunc_cond_zero_arg.bcfcmp.bcconflicting_names.bcstruct.bcissue_183_literal_structs.bcissue_127_uint128_t_lit.bcglobal_using_function_decl.bcshort.bcinit_list.bcreg_test_structure_fields.bcret0.bcgoto_loop.bctrunc.bcbitops.bccast.bcnullptr.bcnested_struct.bcarray_swap.bcbitmask.bcbinops.bcfloat.bcnested_while.bczeroinit.bcfuncptr.bcstruct_swap.bcbranch.bcvectors.bcissue_4.bcconflicting_global.bcissue_123_uint128_t.bcfizzbuzz_stateful.bcissue_94_strncmp.bcbool.bczext.bcbyval_struct.bcfunc_cond_two_arg.bcinttoptr.bcassert.bcloop.bcswitch.bctemplate_parameter_pack.bcbyval_tail_gep.llbyval_tail_nogep.ll |
No description provided.