[PATCH] D43181: [CodeGen] Initialize large arrays by copying from a global

John McCall via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 12 09:20:03 PST 2018


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;
----------------
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.


Repository:
  rL LLVM

https://reviews.llvm.org/D43181





More information about the llvm-commits mailing list