brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1023 B · 7f3bd3b Raw
31 lines · cpp
1//===- GetIntrinsicInfoTableEntries.cpp - IIT signature benchmark ---------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#include "benchmark/benchmark.h"
10#include "llvm/ADT/SmallVector.h"
11#include "llvm/IR/Intrinsics.h"
12
13using namespace llvm;
14using namespace Intrinsic;
15
16static void BM_GetIntrinsicInfoTableEntries(benchmark::State &state) {
17  SmallVector<IITDescriptor> Table;
18  for (auto _ : state) {
19    for (ID ID = 1; ID < num_intrinsics; ++ID) {
20      // This makes sure the vector does not keep growing, as well as after the
21      // first iteration does not result in additional allocations.
22      Table.clear();
23      getIntrinsicInfoTableEntries(ID, Table);
24    }
25  }
26}
27
28BENCHMARK(BM_GetIntrinsicInfoTableEntries);
29
30BENCHMARK_MAIN();
31