[llvm-profgen] Filter out oversized LBR ranges.
authorHongtao Yu <hoy@fb.com>
Thu, 12 May 2022 04:33:09 +0000 (21:33 -0700)
committerwlei <wlei@fb.com>
Thu, 12 May 2022 17:58:50 +0000 (10:58 -0700)
commit9f732af583c0dba58847b753a87cc5432ec33f09
tree8004d995f4391a99bec4731b4cbfab93ee897f6e
parent9145cb8b7c9acd6e7980047e048007bc58b7fab9
[llvm-profgen] Filter out oversized LBR ranges.

As a follow up to {D123271}, LBR ranges that are too big should also be considered as invalid.

For example, the last two pairs in the following trace form a range [0x0d7b02b0, 0x368ba706] that covers a ton of functions in the binary. Such oversized range should also be ignored.

   0x0c74505f/0x368b99a0 **0x368ba706**/0x0c745040  0x0d7b1c3f/**0x0d7b02b0**

Add a defensive check to filter out those ranges based that the valid range should not cross the unconditional branch(Call, return, unconditional jmp).

Reviewed By: hoy, wenlei

Differential Revision: https://reviews.llvm.org/D125448
llvm/test/tools/llvm-profgen/Inputs/invalid-range.perfscript
llvm/test/tools/llvm-profgen/invalid-range.test
llvm/tools/llvm-profgen/PerfReader.cpp
llvm/tools/llvm-profgen/PerfReader.h
llvm/tools/llvm-profgen/ProfiledBinary.cpp
llvm/tools/llvm-profgen/ProfiledBinary.h