[PATCH] D42528: [LTO] - Introduce GlobalResolution::Prevailing flag.

Rafael Avila de Espindola via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 25 07:15:50 PST 2018


George Rimar via Phabricator <reviews at reviews.llvm.org> writes:

> Index: lib/LTO/LTO.cpp
> ===================================================================
> --- lib/LTO/LTO.cpp
> +++ lib/LTO/LTO.cpp
> @@ -419,11 +419,14 @@
>      auto &GlobalRes = GlobalResolutions[Sym.getName()];
>      GlobalRes.UnnamedAddr &= Sym.isUnnamedAddr();
>      if (Res.Prevailing) {
> -      assert(GlobalRes.IRName.empty() &&
> +      assert(!GlobalRes.Prevailing &&
>               "Multiple prevailing defs are not allowed");
> -      GlobalRes.IRName = Sym.getIRName();
> +      GlobalRes.Prevailing = true;
>      }
>  
> +    if (GlobalRes.IRName.empty())
> +      GlobalRes.IRName = Sym.getIRName();

Why do you need the second if? It is still true that only for prevailing
symbols we need the name, no?

That is, could this be:

  if (Res.Prevailing) {
      assert(!GlobalRes.Prevailing &&
             "Multiple prevailing defs are not allowed");
      GlobalRes.IRName = Sym.getIRName();
      GlobalRes.Prevailing = true;
      GlobalRes.IRName = Sym.getIRName();
  }

Cheers,
Rafael


More information about the llvm-commits mailing list