diff options
author | Namhyung Kim <namhyung@kernel.org> | 2024-03-29 14:58:09 -0700 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2024-04-03 11:48:57 -0300 |
commit | 10adbf777622e22323abbf9f7861c26deb373199 (patch) | |
tree | 76841edbc2e79300027c739dd276984be55489fa /tools/perf/util/annotate.c | |
parent | ad399baa06931a62d1166d215eaad6f3b0dcd3d5 (diff) |
perf annotate: Add and use ins__is_nop()
Likewise, add ins__is_nop() to check if the current instruction is NOP.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Tested-by: Ian Rogers <irogers@google.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: https://lore.kernel.org/r/20240329215812.537846-3-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/annotate.c')
-rw-r--r-- | tools/perf/util/annotate.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c index 986c499150ef..5d0ca004dcfb 100644 --- a/tools/perf/util/annotate.c +++ b/tools/perf/util/annotate.c @@ -757,6 +757,11 @@ static struct ins_ops ret_ops = { .scnprintf = ins__raw_scnprintf, }; +bool ins__is_nop(const struct ins *ins) +{ + return ins->ops == &nop_ops; +} + bool ins__is_ret(const struct ins *ins) { return ins->ops == &ret_ops; @@ -1785,7 +1790,7 @@ static void delete_last_nop(struct symbol *sym) dl = list_entry(list->prev, struct disasm_line, al.node); if (dl->ins.ops) { - if (dl->ins.ops != &nop_ops) + if (!ins__is_nop(&dl->ins)) return; } else { if (!strstr(dl->al.line, " nop ") && |