Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / llvm / tools / llvm-dis-fuzzer / llvm-dis-fuzzer.cpp
bloba5c4e0fda72c5e823828216c15fe0943c567ee0c
1 //===-- llvm-dis-fuzzer.cpp - Fuzzer for llvm-dis using lib/Fuzzer --------===//
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 // Fuzzer for LLVM bitcode reading.
11 //===----------------------------------------------------------------------===//
13 #include "llvm/Bitcode/BitcodeReader.h"
14 #include "llvm/IR/LLVMContext.h"
15 #include "llvm/IR/Module.h"
16 #include "llvm/Support/MemoryBuffer.h"
18 using namespace llvm;
20 extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
21 LLVMContext Context;
22 auto Buffer = MemoryBuffer::getMemBuffer(
23 StringRef(reinterpret_cast<const char *>(Data), Size), "Fuzzer input",
24 /*RequiresNullTerminator=*/false);
25 consumeError(
26 parseBitcodeFile(Buffer->getMemBufferRef(), Context).takeError());
27 return 0;