[compiler-rt] 1688868 - Revert "[gcov] Ignore blocks from another file"
Arthur Eubanks via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 14 09:26:06 PDT 2023
Author: Arthur Eubanks
Date: 2023-08-14T09:25:34-07:00
New Revision: 168886891651ac92428f8a9992ac3af6df0de306
URL: https://github.com/llvm/llvm-project/commit/168886891651ac92428f8a9992ac3af6df0de306
DIFF: https://github.com/llvm/llvm-project/commit/168886891651ac92428f8a9992ac3af6df0de306.diff
LOG: Revert "[gcov] Ignore blocks from another file"
This reverts commit 1f34e282e8066281eb1447e21e44a2a2e9983e79.
Test fails on x86-64 mac, see comments on https://reviews.llvm.org/rG1f34e282e8066281eb1447e21e44a2a2e9983e79.
Added:
Modified:
llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp
Removed:
compiler-rt/test/profile/Posix/gcov-file-change.cpp
################################################################################
diff --git a/compiler-rt/test/profile/Posix/gcov-file-change.cpp b/compiler-rt/test/profile/Posix/gcov-file-change.cpp
deleted file mode 100644
index b6b32d69886925..00000000000000
--- a/compiler-rt/test/profile/Posix/gcov-file-change.cpp
+++ /dev/null
@@ -1,40 +0,0 @@
-// RUN: rm -rf %t && split-file %s %t && cd %t
-// RUN: %clangxx --coverage main.cpp -o t
-// RUN: %run ./t
-// RUN: llvm-cov gcov -t t-main. | FileCheck %s
-
-//--- main.cpp
-#include "a.h"
-#include <stdio.h>
-
-// CHECK: Runs:1
-/// __cxx_global_var_init contains a block from a.h. Don't attribute its lines to main.cpp.
-// CHECK-NOT: {{^ +[0-9]+:}}
-
-inline auto *const inl_var_main = // CHECK: 1: [[#]]:inline auto
- new A; // CHECK-NEXT: 1: [[#]]:
-void foo(int x) { // CHECK-NEXT: 1: [[#]]:
- if (x) { // CHECK-NEXT: 1: [[#]]:
-#include "a.inc"
- }
-}
-// CHECK-NOT: {{^ +[0-9]+:}}
-
-int main(int argc, char *argv[]) { // CHECK: 1: [[#]]:int main
- foo(1); // CHECK-NEXT: 1: [[#]]:
-} // CHECK-NEXT: 1: [[#]]:
-// CHECK-NOT: {{^ +[0-9]+:}}
-
-// CHECK: Source:a.h
-// CHECK: 1: 1:struct A
-// CHECK-NOT: {{^ +[0-9]+:}}
-
-//--- a.h
-struct A { A() { } }; // CHECK: 2: [[#]]:struct A
-inline auto *const inl_var_a =
- new A;
-/// TODO a.inc:1 should have line execution.
-// CHECK-NOT: {{^ +[0-9]+:}}
-
-//--- a.inc
-puts("");
diff --git a/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp b/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp
index 74e9a387ea91ec..331d92d8e10bdd 100644
--- a/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp
+++ b/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp
@@ -898,9 +898,7 @@ bool GCOVProfiler::emitProfileNotes(
if (Line == Loc.getLine()) continue;
Line = Loc.getLine();
- MDNode *Scope = Loc.getScope();
- // TODO: Handle blocks from another file due to #line, #include, etc.
- if (isa<DILexicalBlockFile>(Scope) || SP != getDISubprogram(Scope))
+ if (SP != getDISubprogram(Loc.getScope()))
continue;
GCOVLines &Lines = Block.getFile(Filename);
More information about the llvm-commits
mailing list