Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / compiler-rt / test / fuzzer / ReloadTest.cpp
blob853f7ba99e15bcb6bc940853d15af21ca8deea7e
1 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
2 // See https://llvm.org/LICENSE.txt for license information.
3 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
5 // Test that fuzzer we can reload artifacts with any bytes inside.
6 #include <algorithm>
7 #include <cstdint>
8 #include <cstdlib>
9 #include <numeric>
10 #include <set>
12 extern "C" size_t LLVMFuzzerCustomMutator(uint8_t *Data, size_t Size,
13 size_t MaxSize, unsigned int Seed) {
14 std::srand(Seed);
15 std::generate(Data, Data + MaxSize, std::rand);
16 return MaxSize;
19 extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
20 if (Size > 5000 && std::set<uint8_t>(Data, Data + Size).size() > 255 &&
21 (uint8_t)std::accumulate(Data, Data + Size, uint8_t(Size)) == 0)
22 abort();
23 return 0;