Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / compiler-rt / test / fuzzer / LargeTest.cpp
blob7c942a91bf06374e7dc5d694d07ec14626f495ba
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 // A fuzz target with lots of edges.
6 #include <cstdint>
7 #include <cstdlib>
9 static inline void break_optimization(const void *arg) {
10 __asm__ __volatile__("" : : "r" (arg) : "memory");
13 #define A \
14 do { \
15 i++; \
16 c++; \
17 if (Data[(i + __LINE__) % Size] == (c % 256)) \
18 break_optimization(Data); \
19 else \
20 break_optimization(0); \
21 } while (0)
23 // for (int i = 0, n = Data[(__LINE__ - 1) % Size] % 16; i < n; i++)
25 #define B do{A; A; A; A; A; A; A; A; A; A; A; A; A; A; A; A; A; A; }while(0)
26 #define C do{B; B; B; B; B; B; B; B; B; B; B; B; B; B; B; B; B; B; }while(0)
27 #define D do{C; C; C; C; C; C; C; C; C; }while(0)
29 volatile int sink;
30 extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
31 if (!Size) return 0;
32 int c = 0;
33 int i = 0;
35 return 0;