SchrodingerZhu updated this revision to Diff 441819.
SchrodingerZhu added a comment.

address CR


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D129009/new/

https://reviews.llvm.org/D129009

Files:
  llvm/lib/Analysis/ModuleSummaryAnalysis.cpp
  llvm/lib/Bitcode/Writer/BitcodeWriter.cpp


Index: llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
===================================================================
--- llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
+++ llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
@@ -4103,8 +4103,7 @@
 
   for (const GlobalAlias &A : M.aliases()) {
     auto *Aliasee = A.getAliaseeObject();
-    if (!Aliasee->hasName() ||
-        Aliasee->getValueID() == Value::ValueTy::GlobalIFuncVal)
+    if (!Aliasee->hasName() || isa<GlobalIFunc>(Aliasee))
       // IFunc function and Nameless function don't have an entry in the
       // summary, skip it.
       continue;
Index: llvm/lib/Analysis/ModuleSummaryAnalysis.cpp
===================================================================
--- llvm/lib/Analysis/ModuleSummaryAnalysis.cpp
+++ llvm/lib/Analysis/ModuleSummaryAnalysis.cpp
@@ -649,23 +649,24 @@
 static void computeAliasSummary(ModuleSummaryIndex &Index, const GlobalAlias 
&A,
                                 DenseSet<GlobalValue::GUID> &CantBePromoted) {
   auto *Aliasee = A.getAliaseeObject();
-  // Currently, skip summary for indirect function aliases as
+  // Skip summary for indirect function aliases as
   // summary for aliasee will not be emitted.
-  if (Aliasee->getValueID() != Value::ValueTy::GlobalIFuncVal) {
-    bool NonRenamableLocal = isNonRenamableLocal(A);
-    GlobalValueSummary::GVFlags Flags(
-        A.getLinkage(), A.getVisibility(), NonRenamableLocal,
-        /* Live = */ false, A.isDSOLocal(), A.canBeOmittedFromSymbolTable());
-    auto AS = std::make_unique<AliasSummary>(Flags);
-    auto AliaseeVI = Index.getValueInfo(Aliasee->getGUID());
-    assert(AliaseeVI && "Alias expects aliasee summary to be available");
-    assert(AliaseeVI.getSummaryList().size() == 1 &&
-           "Expected a single entry per aliasee in per-module index");
-    AS->setAliasee(AliaseeVI, AliaseeVI.getSummaryList()[0].get());
-    if (NonRenamableLocal)
-      CantBePromoted.insert(A.getGUID());
-    Index.addGlobalValueSummary(A, std::move(AS));
+  if (isa<GlobalIFunc>(Aliasee)) {
+    return;
   }
+  bool NonRenamableLocal = isNonRenamableLocal(A);
+  GlobalValueSummary::GVFlags Flags(
+      A.getLinkage(), A.getVisibility(), NonRenamableLocal,
+      /* Live = */ false, A.isDSOLocal(), A.canBeOmittedFromSymbolTable());
+  auto AS = std::make_unique<AliasSummary>(Flags);
+  auto AliaseeVI = Index.getValueInfo(Aliasee->getGUID());
+  assert(AliaseeVI && "Alias expects aliasee summary to be available");
+  assert(AliaseeVI.getSummaryList().size() == 1 &&
+         "Expected a single entry per aliasee in per-module index");
+  AS->setAliasee(AliaseeVI, AliaseeVI.getSummaryList()[0].get());
+  if (NonRenamableLocal)
+    CantBePromoted.insert(A.getGUID());
+  Index.addGlobalValueSummary(A, std::move(AS));
 }
 
 // Set LiveRoot flag on entries matching the given value name.


Index: llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
===================================================================
--- llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
+++ llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
@@ -4103,8 +4103,7 @@
 
   for (const GlobalAlias &A : M.aliases()) {
     auto *Aliasee = A.getAliaseeObject();
-    if (!Aliasee->hasName() ||
-        Aliasee->getValueID() == Value::ValueTy::GlobalIFuncVal)
+    if (!Aliasee->hasName() || isa<GlobalIFunc>(Aliasee))
       // IFunc function and Nameless function don't have an entry in the
       // summary, skip it.
       continue;
Index: llvm/lib/Analysis/ModuleSummaryAnalysis.cpp
===================================================================
--- llvm/lib/Analysis/ModuleSummaryAnalysis.cpp
+++ llvm/lib/Analysis/ModuleSummaryAnalysis.cpp
@@ -649,23 +649,24 @@
 static void computeAliasSummary(ModuleSummaryIndex &Index, const GlobalAlias &A,
                                 DenseSet<GlobalValue::GUID> &CantBePromoted) {
   auto *Aliasee = A.getAliaseeObject();
-  // Currently, skip summary for indirect function aliases as
+  // Skip summary for indirect function aliases as
   // summary for aliasee will not be emitted.
-  if (Aliasee->getValueID() != Value::ValueTy::GlobalIFuncVal) {
-    bool NonRenamableLocal = isNonRenamableLocal(A);
-    GlobalValueSummary::GVFlags Flags(
-        A.getLinkage(), A.getVisibility(), NonRenamableLocal,
-        /* Live = */ false, A.isDSOLocal(), A.canBeOmittedFromSymbolTable());
-    auto AS = std::make_unique<AliasSummary>(Flags);
-    auto AliaseeVI = Index.getValueInfo(Aliasee->getGUID());
-    assert(AliaseeVI && "Alias expects aliasee summary to be available");
-    assert(AliaseeVI.getSummaryList().size() == 1 &&
-           "Expected a single entry per aliasee in per-module index");
-    AS->setAliasee(AliaseeVI, AliaseeVI.getSummaryList()[0].get());
-    if (NonRenamableLocal)
-      CantBePromoted.insert(A.getGUID());
-    Index.addGlobalValueSummary(A, std::move(AS));
+  if (isa<GlobalIFunc>(Aliasee)) {
+    return;
   }
+  bool NonRenamableLocal = isNonRenamableLocal(A);
+  GlobalValueSummary::GVFlags Flags(
+      A.getLinkage(), A.getVisibility(), NonRenamableLocal,
+      /* Live = */ false, A.isDSOLocal(), A.canBeOmittedFromSymbolTable());
+  auto AS = std::make_unique<AliasSummary>(Flags);
+  auto AliaseeVI = Index.getValueInfo(Aliasee->getGUID());
+  assert(AliaseeVI && "Alias expects aliasee summary to be available");
+  assert(AliaseeVI.getSummaryList().size() == 1 &&
+         "Expected a single entry per aliasee in per-module index");
+  AS->setAliasee(AliaseeVI, AliaseeVI.getSummaryList()[0].get());
+  if (NonRenamableLocal)
+    CantBePromoted.insert(A.getGUID());
+  Index.addGlobalValueSummary(A, std::move(AS));
 }
 
 // Set LiveRoot flag on entries matching the given value name.
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to