ldc/tests/codegen/array_equals_memcmp_2.d
Johan Engelen a4055962fe Implement optimization: compare slices using memcmp if valid (#2047)
This also fixes a pessimization where the `memcmp` call would become an `invoke` if the user provides his own `memcmp` prototype in the code (the prototype would not carry the `nounwind` function attribute).
2017-03-29 20:00:21 +02:00

11 lines
360 B
D

// Tests that static array (in)equality of unequal lengths is optimized to `false`.
// RUN: %ldc -c -O3 -output-ll -of=%t.ll %s && FileCheck %s --check-prefix=LLVM < %t.ll
// LLVM-LABEL: define{{.*}} @{{.*}}different_lengths
// ASM-LABEL: different_lengths{{.*}}:
bool different_lengths(bool[4] a, bool[3] b)
{
// LLVM: ret i1 false
return a == b;
}