diff --git a/llvm/test/tools/llvm-profgen/inline-noprobe2.test b/llvm/test/tools/llvm-profgen/inline-noprobe2.test --- a/llvm/test/tools/llvm-profgen/inline-noprobe2.test +++ b/llvm/test/tools/llvm-profgen/inline-noprobe2.test @@ -1,4 +1,5 @@ - +; RUN: llvm-profgen --format=text --perfscript=%S/Inputs/inline-noprobe2.perfscript --binary=%S/Inputs/inline-noprobe2.perfbin --output=%t --skip-symbolization --use-offset=0 +; RUN: FileCheck %s --input-file %t --check-prefix=CHECK-RAW-PROFILE ; RUN: llvm-profgen --format=text --perfscript=%S/Inputs/inline-noprobe2.perfscript --binary=%S/Inputs/inline-noprobe2.perfbin --output=%t ; RUN: FileCheck %s --input-file %t --check-prefix=CHECK @@ -11,6 +12,10 @@ ; CHECK-SYM-LIST: partition_pivot_last ; CHECK-SYM-LIST: quick_sort + +;CHECK-RAW-PROFILE-NOT: 7f7448e889e4 +;CHECK-RAW-PROFILE-NOT: 7f7448e88826 + ;CHECK: partition_pivot_first:1045:5 ;CHECK-NEXT: 0: 5 ;CHECK-NEXT: 1: 5 diff --git a/llvm/tools/llvm-profgen/PerfReader.cpp b/llvm/tools/llvm-profgen/PerfReader.cpp --- a/llvm/tools/llvm-profgen/PerfReader.cpp +++ b/llvm/tools/llvm-profgen/PerfReader.cpp @@ -490,9 +490,9 @@ // if there's no incoming branch before the external branch in reverse // order. if (IsExternal) { - if (PrevTrDst) + if (PrevTrDst || LBRStack.empty()) continue; - else if (!LBRStack.empty()) { + else { WithColor::warning() << "Invalid transfer to external code in LBR record at line " << TraceIt.getLineNumber() << ": " << TraceIt.getCurrentLine()