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
Evaluate X86TargetLowering::MaxStoresPerMemcpyOptSize #27789
Comments
Some notes: I tried bootstrapping Clang on 32-bit x86 with -Os and different values for MaxStoresPerMemcpyOptSize and MaxStoresPerMemmoveOptSize Size MaxStoresPerMemcpyOptSize (4 is the default) So it seems setting it to 1 would be a size win. But there might be more going on here. Consider the following example: #include <string.h> At -O2 we will lower it with loads and stores: At -Os, with the threshold set to 1, we make the call, and save one byte: 00000000 : However, if dst and src in the source were "int" instead of "char", we'd use rep;movs to copy two 4-byte words, and do one 1-byte move afterwards, causing much larger code: 00000000 : The rep;movs lowering comes from X86SelectionDAGInfo::EmitTargetCodeForMemcpy. If we were to just 1-byte rep;movs instead, the code would be: 00000000 : Which is the smallest yet. Maybe at -Os we should try to avoid ending up with remaining bytes after rep;movs and instead work with a smaller type, or just make the library call. Perhaps doing this would be better than trying to lower MaxStoresPerMemcpyOptSize. (Mostly notes to self) Needed to apply this patch to avoid crashing: --- a/lib/Target/X86/X86SelectionDAGInfo.cpp unsigned UBytes = AVT.getSizeInBits() / 8;
|
Some measurements on a 32-bit Chrome build on Windows: Threshold Size (chrome_child.dll) |
Extended Description
r265836, which causes more memcpys to be expanded, grew chrome_child.dll by 240 KB.
I suspect that maybe X86TargetLowering::MaxStoresPerMemcpyOptSize should be reduced, at least on 32-bit where we lower calls with smaller code than we used to.
The text was updated successfully, but these errors were encountered: