[libcxx-commits] [libcxx] [libc++] Ensure that we vectorize algorithms on all Clang-based compilers (PR #132090)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Thu Mar 20 12:37:08 PDT 2025


================
@@ -0,0 +1,19 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// We don't know how to vectorize algorithms on GCC
+// XFAIL: gcc
+
+// This test ensures that we enable the vectorization of algorithms on the expected
+// platforms.
+
+#include <algorithm>
+
+#if !_LIBCPP_VECTORIZE_ALGORITHMS
----------------
ldionne wrote:

I think we use `-Wundef` to catch that very issue. If we do `#if ! _LIBCPP_VECTORIZE_ALGORITHMS` and `_LIBCPP_VECTORIZE_ALGORITHMS` isn't defined, I'd expect a compiler diagnostic.

That being said, I've made the change you suggested to check for `#ifndef _LIBCPP_VECTORIZE_ALGORITHMS` explicitly and say that the test is broken in that case, which was your original intent IIUC.

https://github.com/llvm/llvm-project/pull/132090


More information about the libcxx-commits mailing list