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

acc/pass: handle missing allocations #137

Merged
merged 2 commits into from
Nov 2, 2021
Merged

Conversation

mmcloughlin
Copy link
Owner

The variable allocator currently raises an assertion error if it encounters a
write to an operand without an allocation. Allocation is done like liveness
analysis: the instructions are processed in reverse and variables are
allocated as they are read, freed when they're written to. Therefore this
assertion would trigger if the operand is never read after it's written.

Therefore, this would only happen for a redundant chain which computes a
value it never needs. Clearly this isn't ideal, but it does seem to happen for
some algorithms. It seems best that the allocator doesn't crash in these
cases.

This PR updates the allocation logic to handle this case. In practice if this
happens the variable would be immediately allocated and freed.

Updates #129 #133 #136

@codecov-commenter
Copy link

codecov-commenter commented Nov 2, 2021

Codecov Report

Merging #137 (0667815) into master (33f7a03) will increase coverage by 0.23%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #137      +/-   ##
==========================================
+ Coverage   73.76%   74.00%   +0.23%     
==========================================
  Files          36       36              
  Lines        2169     2177       +8     
==========================================
+ Hits         1600     1611      +11     
+ Misses        494      492       -2     
+ Partials       75       74       -1     
Flag Coverage Δ
unittests 74.00% <100.00%> (+0.23%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
acc/pass/alloc.go 95.58% <100.00%> (+5.58%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 33f7a03...0667815. Read the comment docs.

@mmcloughlin mmcloughlin merged commit 515cfe4 into master Nov 2, 2021
@mmcloughlin mmcloughlin deleted the handle-missing-alloc branch November 2, 2021 06:27
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.

2 participants