[BOLT] Fix --max-funcs=<N> option
authorMaksim Panchenko <maks@fb.com>
Mon, 12 Jun 2023 20:16:09 +0000 (13:16 -0700)
committerMaksim Panchenko <maks@fb.com>
Mon, 12 Jun 2023 23:54:14 +0000 (16:54 -0700)
commitc4e60a7f6045efc317087f964341f74a3f1b6446
treee7eebedeeda29a9c10a3585e791421384de0cb9d
parent1ea903e1641f907efc80278cbdf57b91b842716e
[BOLT] Fix --max-funcs=<N> option

Fix off-by-one error while handling of the --max-funcs=<N> option.
We used to process N+1 functions when N was requested.

Reviewed By: Amir

Differential Revision: https://reviews.llvm.org/D152751
bolt/lib/Rewrite/RewriteInstance.cpp
bolt/test/max-funcs.test [new file with mode: 0644]