-
Notifications
You must be signed in to change notification settings - Fork 10.5k
SILOptimizer: support for Dictionary literals generated in the data section. #24205
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
SILOptimizer: support for Dictionary literals generated in the data section. #24205
Conversation
@swift-ci test |
@swift-ci benchmark |
Code size: -O
Performance: -Osize
Code size: -Osize
How to read the dataThe tables contain differences in performance which are larger than 8% and differences in code size which are larger than 1%.If you see any unexpected regressions, you should consider fixing the Noise: Sometimes the performance results (not code size!) contain false Hardware Overview
|
Nice! |
unsigned TupleIdx = TEA->getFieldNo(); | ||
assert(TupleIdx < NumTailTupleElements); | ||
for (Operand *Use : TEA->getUses()) { | ||
if (!handleTailAddr(TailIdx * NumTailTupleElements + TupleIdx, Use->getUser(), 0,TailStores)) |
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.
This line looks too long :)
llvm::DenseMap<VarDecl *, StoreInst *> MemberStores; | ||
|
||
// A store for each element of the tail allocated array. In case of a tuple, there is a store | ||
// for each tuple element. For example, a 3 element0 array of 2-element tuples |
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.
typo "element0"
…ection. Actually: generate the array of (key, value) tuples in the data section, which is then passed to Dictionary.init(dictionaryLiteral:) We already do this for simple arrays, e.g. arrays with trivial element types. The only change needed for dictionary literals is to support tuple types in the ObjectOutliner. The effect of this optimization is a significant reduction in code size for dictionary literals - and an increase in data size. But in most cases there is a considerable net win for code+data size in total.
b918497
to
a402544
Compare
@swift-ci smoke test and merge |
1 similar comment
@swift-ci smoke test and merge |
Actually: generate the array of (key, value) tuples in the data section, which is then passed to Dictionary.init(dictionaryLiteral:)
We already do this for simple arrays, e.g. arrays with trivial element types.
The only change needed for dictionary literals is to support tuple types in the ObjectOutliner.
The effect of this optimization is a significant reduction in code size for dictionary literals - and an increase in data size.
But in most cases there is a considerable net win for code+data size in total.