Skip to content

Zero out only the first pointer when canceling cleanups, and don't zero out PODs #4400

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

Closed
pcwalton opened this issue Jan 9, 2013 · 5 comments
Labels
A-codegen Area: Code generation I-slow Issue: Problems and improvements with respect to performance of generated code.

Comments

@pcwalton
Copy link
Contributor

pcwalton commented Jan 9, 2013

There's generally no need to zero out PODs, and no need to zero out anything beyond the first pointer of a non-POD data structure containing unique values. (Drop glue can simply bail out at the first null pointer it finds.)

LLVM does not optimize out redundant zeroing out of structs, unless all functions that operate on the struct are inlined and SROA happens. Neither does GCC. I believe (but haven't thought too deeply about it) that this is probably an unsafe optimization with the semantics of C. So this could be a rather large win for code size.

@graydon
Copy link
Contributor

graydon commented Apr 24, 2013

was this fixed? (is it part of the thing triggering valgrind problems currently?)

@bblum
Copy link
Contributor

bblum commented Jun 22, 2013

This optimization would be subsumed by #5016, but would be significantly easier than that project, so might get done on a faster timescale.

@thestinger
Copy link
Contributor

This is still an issue, we do many zeroes of the entire value.

@pnkfelix
Copy link
Member

pnkfelix commented Feb 6, 2014

closing; this problem will go away with the dtor reworking

@pnkfelix pnkfelix closed this as completed Feb 6, 2014
@nikomatsakis
Copy link
Contributor

Subsumed by #5016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-codegen Area: Code generation I-slow Issue: Problems and improvements with respect to performance of generated code.
Projects
None yet
Development

No branches or pull requests

6 participants