rjmccall added inline comments.
================
Comment at: lib/CodeGen/CGExprAgg.cpp:421
+  // with explicit initializers should be large enough.
+  if (NumInitElements > 8 && elementType->isBuiltinType()) {
+    CodeGen::CodeGenModule &CGM = CGF.CGM;
----------------
kosarev wrote:
> rjmccall wrote:
> > Is there a good reason to use an element-count heuristic instead of a 
> > total-size heuristic here?
> > 
> > Why only builtin types?  That seems to pointlessly rule out nested arrays, 
> > complex types, vectors, C structs, and so on.  I think the predicate you 
> > probably want here is isTriviallyCopyableType.
> > Is there a good reason to use an element-count heuristic instead of a 
> > total-size heuristic here?
> 
> Yes, the code below generates per-element initialization only for explicitly 
> specified initializers. The rest, if any, is initialized with a filler, so it 
> doesn't affect the size of the resulting code much.
That makes sense, but you could still base it on the total size being 
initialized with explicit initializers.  Such initializers, even when constant, 
are likely to require code size basically proportionate to the number of bytes 
initialized — sizes of immediate operands and all that.


https://reviews.llvm.org/D43181



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to