-
Notifications
You must be signed in to change notification settings - Fork 13
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
bugfix : symbols from the inlined member's dummies were hoisted in the calling routine #162
Conversation
Codecov Report
@@ Coverage Diff @@
## main #162 +/- ##
=======================================
Coverage 92.10% 92.10%
=======================================
Files 90 90
Lines 16628 16628
=======================================
Hits 15315 15315
Misses 1313 1313
Flags with carried forward coverage won't be shown. Click here to find out more.
|
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.
Hi @JoeffreyLegaux I'm not sure I agree with your assessment that we want to keep arguments of the child routine in decls
and thus hoist them to the parent. Could you please provide an example or test for the behaviour that breaks with the current implementation and is fixed by this PR? (Apologies if I'm misunderstanding the intention of you fix here; I find these things easier to comprehend in code.)
For context, the original idea of the implementation is that all arguments to the child are replaced symbolically with the remapped version of the value passed to the call in a particular call context. That means, only purely locally defined variables need to be hoisted up to the parent context, as these are not replaced by the remapping. The decls
tuple in this line is simply filtering the local declarations from the argument declarations, so that we may only hoist those local temporaries. Do you have a case where argument declarations need to be hoisted too?
Hello @mlange05, I guess my comment was not perfectly clear as I thought the change in the code was self-explanatory. But that is not what is happening currently, you can check it out with a simple example. If you look at the code, here line 245 gets the list of variables in the member spec. |
Here is a very simple test case that highlights the issue :
After inlining, both the declarations of MEMB_ARRAY and MEMB_LOCAL get hoisted with the current implementation, while we obviously only want the latter. |
@JoeffreyLegaux Ahhh, I see now. Yes, you are right, we are accidentally hoisting the old declaration, because the filtering is wrong, and yes your change fixes that! We still need to add a test to catch this in the future, but one of the existing ones should be ok for that. I'll try and add that to your branch. |
…tead of the routine dummies
0f1f9d7
to
c713121
Compare
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.
Ok, this is looking good now. Many thanks @JoeffreyLegaux for finding this and filing a bug, and thanks for the explanation/code example.
We want to eliminate the symbols from dummies variables when hoisting the local variables from an inlined member routine to its caller.
The check eliminated symbols from the routine._dummies list, but we rather want the list of memeber._dummies