diff options
| author | Reid Kleckner <rnk@google.com> | 2019-07-04 00:03:30 +0000 | 
|---|---|---|
| committer | Reid Kleckner <rnk@google.com> | 2019-07-04 00:03:30 +0000 | 
| commit | f7e52fbdb5a7af8ea0808e98458b497125a5eca1 (patch) | |
| tree | e7ff60e16fd3a7c1b066d2ff8d3f4152525205dc /llvm/lib/AsmParser | |
| parent | ec4be576554c8be1c0a47cb78d411c3f42ba69e9 (diff) | |
| download | bcm5719-llvm-f7e52fbdb5a7af8ea0808e98458b497125a5eca1.tar.gz bcm5719-llvm-f7e52fbdb5a7af8ea0808e98458b497125a5eca1.zip | |
Revert [ThinLTO] Optimize writeonly globals out
This reverts r365040 (git commit 5cacb914758c7f436b47c8362100f10cef14bbc4)
Speculatively reverting, since this appears to have broken check-lld on
Linux. Partial analysis in https://crbug.com/981168.
llvm-svn: 365097
Diffstat (limited to 'llvm/lib/AsmParser')
| -rw-r--r-- | llvm/lib/AsmParser/LLParser.cpp | 57 | 
1 files changed, 15 insertions, 42 deletions
| diff --git a/llvm/lib/AsmParser/LLParser.cpp b/llvm/lib/AsmParser/LLParser.cpp index ab645348c53..51fc5b6e1d2 100644 --- a/llvm/lib/AsmParser/LLParser.cpp +++ b/llvm/lib/AsmParser/LLParser.cpp @@ -7849,13 +7849,9 @@ static const auto FwdVIRef = (GlobalValueSummaryMapTy::value_type *)-8;  static void resolveFwdRef(ValueInfo *Fwd, ValueInfo &Resolved) {    bool ReadOnly = Fwd->isReadOnly(); -  bool WriteOnly = Fwd->isWriteOnly(); -  assert(!(ReadOnly && WriteOnly));    *Fwd = Resolved;    if (ReadOnly)      Fwd->setReadOnly(); -  if (WriteOnly) -    Fwd->setWriteOnly();  }  /// Stores the given Name/GUID and associated summary into the Index. @@ -8085,8 +8081,7 @@ bool LLParser::ParseVariableSummary(std::string Name, GlobalValue::GUID GUID,    GlobalValueSummary::GVFlags GVFlags = GlobalValueSummary::GVFlags(        /*Linkage=*/GlobalValue::ExternalLinkage, /*NotEligibleToImport=*/false,        /*Live=*/false, /*IsLocal=*/false, /*CanAutoHide=*/false); -  GlobalVarSummary::GVarFlags GVarFlags(/*ReadOnly*/ false, -                                        /* WriteOnly */ false); +  GlobalVarSummary::GVarFlags GVarFlags(/*ReadOnly*/ false);    std::vector<ValueInfo> Refs;    VTableFuncList VTableFuncs;    if (ParseToken(lltok::colon, "expected ':' here") || @@ -8427,11 +8422,10 @@ bool LLParser::ParseOptionalRefs(std::vector<ValueInfo> &Refs) {      VContexts.push_back(VC);    } while (EatIfPresent(lltok::comma)); -  // Sort value contexts so that ones with writeonly -  // and readonly ValueInfo  are at the end of VContexts vector. -  // See FunctionSummary::specialRefCounts() +  // Sort value contexts so that ones with readonly ValueInfo are at the end +  // of VContexts vector. This is needed to match immutableRefCount() behavior.    llvm::sort(VContexts, [](const ValueContext &VC1, const ValueContext &VC2) { -    return VC1.VI.getAccessSpecifier() < VC2.VI.getAccessSpecifier(); +    return VC1.VI.isReadOnly() < VC2.VI.isReadOnly();    });    IdToIndexMapType IdToIndexMap; @@ -8749,41 +8743,24 @@ bool LLParser::ParseGVFlags(GlobalValueSummary::GVFlags &GVFlags) {  }  /// GVarFlags -///   ::= 'varFlags' ':' '(' 'readonly' ':' Flag -///                      ',' 'writeonly' ':' Flag ')' +///   ::= 'varFlags' ':' '(' 'readonly' ':' Flag ')'  bool LLParser::ParseGVarFlags(GlobalVarSummary::GVarFlags &GVarFlags) {    assert(Lex.getKind() == lltok::kw_varFlags);    Lex.Lex(); +  unsigned Flag = 0;    if (ParseToken(lltok::colon, "expected ':' here") || -      ParseToken(lltok::lparen, "expected '(' here")) +      ParseToken(lltok::lparen, "expected '(' here") || +      ParseToken(lltok::kw_readonly, "expected 'readonly' here") || +      ParseToken(lltok::colon, "expected ':' here"))      return true; -  auto ParseRest = [this](unsigned int &Val) { -    Lex.Lex(); -    if (ParseToken(lltok::colon, "expected ':'")) -      return true; -    return ParseFlag(Val); -  }; +  ParseFlag(Flag); +  GVarFlags.ReadOnly = Flag; -  do { -    unsigned Flag = 0; -    switch (Lex.getKind()) { -    case lltok::kw_readonly: -      if (ParseRest(Flag)) -        return true; -      GVarFlags.MaybeReadOnly = Flag; -      break; -    case lltok::kw_writeonly: -      if (ParseRest(Flag)) -        return true; -      GVarFlags.MaybeWriteOnly = Flag; -      break; -    default: -      return Error(Lex.getLoc(), "expected gvar flag type"); -    } -  } while (EatIfPresent(lltok::comma)); -  return ParseToken(lltok::rparen, "expected ')' here"); +  if (ParseToken(lltok::rparen, "expected ')' here")) +    return true; +  return false;  }  /// ModuleReference @@ -8806,9 +8783,7 @@ bool LLParser::ParseModuleReference(StringRef &ModulePath) {  /// GVReference  ///   ::= SummaryID  bool LLParser::ParseGVReference(ValueInfo &VI, unsigned &GVId) { -  bool WriteOnly = false, ReadOnly = EatIfPresent(lltok::kw_readonly); -  if (!ReadOnly) -    WriteOnly = EatIfPresent(lltok::kw_writeonly); +  bool ReadOnly = EatIfPresent(lltok::kw_readonly);    if (ParseToken(lltok::SummaryID, "expected GV ID"))      return true; @@ -8823,7 +8798,5 @@ bool LLParser::ParseGVReference(ValueInfo &VI, unsigned &GVId) {    if (ReadOnly)      VI.setReadOnly(); -  if (WriteOnly) -    VI.setWriteOnly();    return false;  } | 

