diff --git a/SingleSource/UnitTests/testcase-CodeGen-1.c b/SingleSource/UnitTests/testcase-CodeGen-1.c new file mode 100644 --- /dev/null +++ b/SingleSource/UnitTests/testcase-CodeGen-1.c @@ -0,0 +1,15 @@ +// COVERAGE: llvm-project/llvm/lib/Analysis/InlineCost.cpp (1 new functions) +// COVERAGE: llvm-project/llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp (2 new functions) +// COVERAGE: llvm-project/llvm/lib/CodeGen/TargetLoweringBase.cpp (2 new functions) +extern void abort(); +#ifndef __SIZEOF_INT128__ +#define __int128 long long // Appears in test case of pr61375.c +#endif +unsigned __int128 a; +void b() { a = (double)a + 0; } +int main() { + b(); + if (a) + abort(); + return 0; +} diff --git a/SingleSource/UnitTests/testcase-CodeGen-1.reference_output b/SingleSource/UnitTests/testcase-CodeGen-1.reference_output new file mode 100644 --- /dev/null +++ b/SingleSource/UnitTests/testcase-CodeGen-1.reference_output @@ -0,0 +1 @@ +exit 0 diff --git a/SingleSource/UnitTests/testcase-CodeGen-2.c b/SingleSource/UnitTests/testcase-CodeGen-2.c new file mode 100644 --- /dev/null +++ b/SingleSource/UnitTests/testcase-CodeGen-2.c @@ -0,0 +1,15 @@ +// COVERAGE: llvm-project/llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp (1 new functions) +// COVERAGE: llvm-project/llvm/lib/CodeGen/TargetLoweringBase.cpp (1 new functions) +extern void abort(); +#ifndef __SIZEOF_INT128__ +#define __int128 long long // Appears in test case of pr61375.c +#endif +float a; +int main() { + __int128 b = a; + if (b + (double)10) + ++b; + while (b != 1) + abort(); + return 0; +} diff --git a/SingleSource/UnitTests/testcase-CodeGen-2.reference_output b/SingleSource/UnitTests/testcase-CodeGen-2.reference_output new file mode 100644 --- /dev/null +++ b/SingleSource/UnitTests/testcase-CodeGen-2.reference_output @@ -0,0 +1 @@ +exit 0 diff --git a/SingleSource/UnitTests/testcase-CodeGen-3.c b/SingleSource/UnitTests/testcase-CodeGen-3.c new file mode 100644 --- /dev/null +++ b/SingleSource/UnitTests/testcase-CodeGen-3.c @@ -0,0 +1,23 @@ +// COVERAGE: llvm-project/clang/lib/AST/ExprConstant.cpp (1 new functions) +// COVERAGE: llvm-project/llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp (1 new functions) +// COVERAGE: llvm-project/llvm/lib/CodeGen/TargetLoweringBase.cpp (1 new functions) +#include "stdio.h" +#ifdef __SIZEOF_INT128__ +typedef __int128 L; // Appears in pr49218.c test case +#else +typedef long long L; +#endif +float f; +int main() { + L i = f; + if (i <= 10 + + 41 * +((long)(((int)10) >> ((int)10))) * + ((long)(((int)(i)) % ((int)10))) - + ((long)(((double)(i)) + ((double)10))) - + ((long)(((int)10) ^ ((int)10)))) + do { + ++i; + printf("%lld", (long long) i); + } while (i != 11); + return 0; +} diff --git a/SingleSource/UnitTests/testcase-CodeGen-3.reference_output b/SingleSource/UnitTests/testcase-CodeGen-3.reference_output new file mode 100644 --- /dev/null +++ b/SingleSource/UnitTests/testcase-CodeGen-3.reference_output @@ -0,0 +1 @@ +1234567891011exit 0 diff --git a/SingleSource/UnitTests/testcase-Float2Int.c b/SingleSource/UnitTests/testcase-Float2Int.c new file mode 100644 --- /dev/null +++ b/SingleSource/UnitTests/testcase-Float2Int.c @@ -0,0 +1,9 @@ +// COVERAGE: llvm-project/llvm/lib/Transforms/Scalar/Float2Int.cpp (1 new functions) +#include "stdio.h" +char b = 32; +int main() { + for (b = ((long)(((double)(b)) * ((double)(b)))); b >= -29; b--) + printf("%d", (int)b); + printf("\n"); + return 0; +} diff --git a/SingleSource/UnitTests/testcase-Float2Int.reference_output b/SingleSource/UnitTests/testcase-Float2Int.reference_output new file mode 100644 --- /dev/null +++ b/SingleSource/UnitTests/testcase-Float2Int.reference_output @@ -0,0 +1,2 @@ +0-1-2-3-4-5-6-7-8-9-10-11-12-13-14-15-16-17-18-19-20-21-22-23-24-25-26-27-28-29 +exit 0 diff --git a/SingleSource/UnitTests/testcase-SelectionDAG.c b/SingleSource/UnitTests/testcase-SelectionDAG.c new file mode 100644 --- /dev/null +++ b/SingleSource/UnitTests/testcase-SelectionDAG.c @@ -0,0 +1,12 @@ +// COVERAGE: llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (1 new functions) +int a; +int main() { + int b = 0; + for (; a; a = 2 - (0 | a)) { + b++; + if (b <= 4) + continue; + break; + } + return b; +} diff --git a/SingleSource/UnitTests/testcase-SelectionDAG.reference_output b/SingleSource/UnitTests/testcase-SelectionDAG.reference_output new file mode 100644 --- /dev/null +++ b/SingleSource/UnitTests/testcase-SelectionDAG.reference_output @@ -0,0 +1 @@ +exit 9 diff --git a/SingleSource/UnitTests/testcase-SimplifyIndVar.c b/SingleSource/UnitTests/testcase-SimplifyIndVar.c new file mode 100644 --- /dev/null +++ b/SingleSource/UnitTests/testcase-SimplifyIndVar.c @@ -0,0 +1,24 @@ +// COVERAGE: llvm-project/llvm/lib/Transforms/Utils/SimplifyIndVar.cpp (1 new functions) +short a; +void foo() { + if (a < 0) + __builtin_abort(); +} +int main() { + int b = 8; + while (a++ <= 0) { + b++; + if (b <= 0 + 1 * (b % 40) * (double)0 - 0 - 0 - + ((040) * ((b))) * ((((int)(b)) << ((int)(b)))) + + ((long)(((double)(b)) - ((double)0))) + + ((long)(((double)0) - ((double)(b)))) - + ((short)(((double)(b)) - ((double)0))) + + ((long)(((int)0) ^ ((int)0))) - + ((long)(((double)(b)) + ((double)0)))) + break; + } + foo(); + if (b != 9) + __builtin_abort(); + return 0; +} diff --git a/SingleSource/UnitTests/testcase-SimplifyIndVar.reference_output b/SingleSource/UnitTests/testcase-SimplifyIndVar.reference_output new file mode 100644 --- /dev/null +++ b/SingleSource/UnitTests/testcase-SimplifyIndVar.reference_output @@ -0,0 +1 @@ +exit 0 diff --git a/SingleSource/UnitTests/testcase-StmtPrinter.c b/SingleSource/UnitTests/testcase-StmtPrinter.c new file mode 100644 --- /dev/null +++ b/SingleSource/UnitTests/testcase-StmtPrinter.c @@ -0,0 +1,21 @@ +// COVERAGE: llvm-project/clang/lib/AST/StmtPrinter.cpp (1 new functions) +char a, b, g, h, i; +short c, d, k; +int e, f, j; +void l() { + k = i > 0 || d > 1 >> d << i; + for (; j; j++) + h = c < 0 || h || c << (8 + 2 - (long)0); + g = f + 1 + 2 * 0 * 0; + for (; f < 1; f = 1 + 2 - 0) + b = a + 1 + 2 * 0; + if (b == 0) + __builtin_abort(); +} +int main() { + for (; e < 1; e++) + l(); + if (h == 0) + __builtin_abort(); + return 0; +} diff --git a/SingleSource/UnitTests/testcase-StmtPrinter.reference_output b/SingleSource/UnitTests/testcase-StmtPrinter.reference_output new file mode 100644 --- /dev/null +++ b/SingleSource/UnitTests/testcase-StmtPrinter.reference_output @@ -0,0 +1 @@ +exit 0 diff --git a/SingleSource/UnitTests/testcase-clang-lib-1.c b/SingleSource/UnitTests/testcase-clang-lib-1.c new file mode 100644 --- /dev/null +++ b/SingleSource/UnitTests/testcase-clang-lib-1.c @@ -0,0 +1,14 @@ +// COVERAGE: llvm-project/clang/include/clang/AST/EvaluatedExprVisitor.h (1 new functions) +// COVERAGE: llvm-project/clang/lib/AST/ComputeDependence.cpp (1 new functions) +// COVERAGE: llvm-project/clang/lib/AST/Expr.cpp (2 new functions) +// COVERAGE: llvm-project/clang/lib/CodeGen/CGExprScalar.cpp (1 new functions) +// COVERAGE: llvm-project/clang/lib/Parse/ParseExpr.cpp (1 new functions) +// COVERAGE: llvm-project/clang/lib/Sema/SemaExpr.cpp (2 new functions) +#include +typedef int (*fptr)(int); +int foo(int i) { return i; } +int main() { + int b = _Generic(foo, fptr : 3, int : 4); + printf("%d\n", b); + return 0; +} diff --git a/SingleSource/UnitTests/testcase-clang-lib-1.reference_output b/SingleSource/UnitTests/testcase-clang-lib-1.reference_output new file mode 100644 --- /dev/null +++ b/SingleSource/UnitTests/testcase-clang-lib-1.reference_output @@ -0,0 +1,2 @@ +3 +exit 0