================
@@ -817,13 +825,12 @@ bool MemProfUsePass::annotateGlobalVariables(
   for (GlobalVariable &GVar : M.globals()) {
     assert(!GVar.getSectionPrefix().has_value() &&
            "GVar shouldn't have section prefix yet");
-    if (GVar.isDeclarationForLinker())
-      continue;
-
-    if (hasExplicitSectionName(GVar)) {
-      ++NumOfMemProfExplicitSectionGlobalVars;
-      LLVM_DEBUG(dbgs() << "Global variable " << GVar.getName()
-                        << " has explicit section name. Skip annotating.\n");
+    auto Kind = llvm::memprof::getAnnotationKind(GVar);
+    switch (Kind) {
----------------
teresajohnson wrote:

Since the switch now only handles 2 cases, this would be clearer written as an 
if condition like:

```
if (Kind != llvm::memprof::AnnotationKind::AnnotationOK) {
   HandleUnsupportedAnnotationKinds(GVar, Kind);
   continue;
}
```

https://github.com/llvm/llvm-project/pull/162348
_______________________________________________
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

Reply via email to