[PATCH] D49771: CodeGen: use non-zero memset when possible for automatic variables

Justin Bogner via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 24 17:52:36 PDT 2018


bogner accepted this revision.
bogner added a comment.
This revision is now accepted and ready to land.

Seems straightforward and correct to me.



================
Comment at: lib/CodeGen/CGDecl.cpp:956-957
+class BytePattern {
+  uint8_t Val;
+  enum class ValueType { Specific, Any, None } Type;
+  BytePattern(ValueType Type) : Type(Type) {}
----------------
Probably makes sense to swap the order of these or give the enum class a smaller underlying type than int.


================
Comment at: lib/CodeGen/CGDecl.cpp:996-998
+    if (!Value.isSplat(8))
+      return BytePattern::None();
+    return BytePattern(Value.getLoBits(8).getLimitedValue());
----------------
Very much a nitpick, but this would be slightly easier to follow written in the order without a negation.


Repository:
  rC Clang

https://reviews.llvm.org/D49771





More information about the cfe-commits mailing list