Skip to content
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

Use a reference to store the LHS of assignments #981

Merged
merged 3 commits into from
Jul 22, 2024

Conversation

PetroZarytskyi
Copy link
Collaborator

@PetroZarytskyi PetroZarytskyi commented Jul 12, 2024

This PR is created to fix #759.

Copy link
Contributor

clang-tidy review says "All clean, LGTM! 👍"

@PetroZarytskyi PetroZarytskyi force-pushed the innermost branch 2 times, most recently from 8789b9e to 3404230 Compare July 12, 2024 12:55
Copy link

codecov bot commented Jul 12, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 93.80%. Comparing base (28dea37) to head (d4c0d6c).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #981      +/-   ##
==========================================
- Coverage   93.94%   93.80%   -0.15%     
==========================================
  Files          55       55              
  Lines        8062     8065       +3     
==========================================
- Hits         7574     7565       -9     
- Misses        488      500      +12     
Files Coverage Δ
include/clad/Differentiator/ReverseModeVisitor.h 97.87% <ø> (ø)
lib/Differentiator/DiffPlanner.cpp 98.71% <100.00%> (+<0.01%) ⬆️
lib/Differentiator/ReverseModeVisitor.cpp 97.31% <100.00%> (-0.01%) ⬇️
lib/Differentiator/TBRAnalyzer.cpp 92.65% <100.00%> (-1.99%) ⬇️

... and 1 file with indirect coverage changes

Files Coverage Δ
include/clad/Differentiator/ReverseModeVisitor.h 97.87% <ø> (ø)
lib/Differentiator/DiffPlanner.cpp 98.71% <100.00%> (+<0.01%) ⬆️
lib/Differentiator/ReverseModeVisitor.cpp 97.31% <100.00%> (-0.01%) ⬇️
lib/Differentiator/TBRAnalyzer.cpp 92.65% <100.00%> (-1.99%) ⬇️

... and 1 file with indirect coverage changes

Copy link
Contributor

clang-tidy review says "All clean, LGTM! 👍"

//CHECK-NEXT: double &_t1 = (t *= x);
//CHECK-NEXT: _t2 = t;
//CHECK-NEXT: _t1 *= y;
//CHECK-NEXT: _t1 = &(t *= x);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is that right? Aren't we taking the address of a temporary that gets destroyed at the end of the expression?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The value of t *= x is a reference to t. So &(t *= x) should give the address of t. Anyway, we used to declare a reference to the same expression and references are pointers under the hood. So this change shouldn't affect the performance or behavior.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, okay, I see. Thanks!

@vgvassilev
Copy link
Owner

@PetroZarytskyi, #971 is merged. Can you rebase?

Copy link
Contributor

clang-tidy review says "All clean, LGTM! 👍"

Copy link
Contributor

clang-tidy review says "All clean, LGTM! 👍"

@PetroZarytskyi PetroZarytskyi marked this pull request as ready for review July 22, 2024 16:40
Copy link
Contributor

clang-tidy review says "All clean, LGTM! 👍"

Copy link
Owner

@vgvassilev vgvassilev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@vgvassilev
Copy link
Owner

I believe the codecov complaint is because we removed more code and it thinks the coverage is reduced...

@vgvassilev vgvassilev merged commit ed26dbd into vgvassilev:master Jul 22, 2024
88 of 89 checks passed
@PetroZarytskyi PetroZarytskyi deleted the innermost branch July 22, 2024 20:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove GetInnermostReturnExpr
2 participants