Put default_instance into a local variable so the compiler can see that it doesn't need to reload from aux.table due to potential aliasing.

PiperOrigin-RevId: 540942693
pull/13040/head
Protobuf Team Bot 2 years ago committed by Copybara-Service
parent 9d0961afb7
commit 9d0d8fb653
  1. 6
      src/google/protobuf/generated_message_tctable_lite.cc

@ -510,10 +510,12 @@ inline PROTOBUF_ALWAYS_INLINE const char* TcParser::RepeatedParseMessageAuxImpl(
const auto expected_tag = UnalignedLoad<TagType>(ptr);
const auto aux = *table->field_aux(data.aux_idx());
auto& field = RefAt<RepeatedPtrFieldBase>(msg, data.offset());
const MessageLite* const default_instance =
aux_is_table ? aux.table->default_instance : aux.message_default();
do {
ptr += sizeof(TagType);
MessageLite* submsg = field.Add<GenericTypeHandler<MessageLite>>(
aux_is_table ? aux.table->default_instance : aux.message_default());
MessageLite* submsg =
field.Add<GenericTypeHandler<MessageLite>>(default_instance);
if (aux_is_table) {
if (group_coding) {
ptr = ctx->ParseGroup<TcParser>(submsg, ptr,

Loading…
Cancel
Save