]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-129987: Disable GCC SLP autovectorization for the interpreter loop on x86-64 ...
authormpage <mpage@meta.com>
Wed, 9 Apr 2025 17:34:12 +0000 (10:34 -0700)
committerGitHub <noreply@github.com>
Wed, 9 Apr 2025 17:34:12 +0000 (10:34 -0700)
The SLP autovectorizer can cause poor code generation for opcode dispatch, negating any benefit we get from vectorization elsewhere in the interpreter loop.

Python/ceval.c

index a59b2b7a16866d9887773b0e50b7b8e7e194892b..47d068edac27438885562e6b628d9c124fec96b9 100644 (file)
@@ -948,7 +948,18 @@ _PyObjectArray_Free(PyObject **array, PyObject **scratch)
 #include "generated_cases.c.h"
 #endif
 
-PyObject* _Py_HOT_FUNCTION
+#if (defined(__GNUC__) && !defined(__clang__)) && defined(__x86_64__)
+/*
+ * gh-129987: The SLP autovectorizer can cause poor code generation for opcode
+ * dispatch, negating any benefit we get from vectorization elsewhere in the
+ * interpreter loop.
+ */
+#define DONT_SLP_VECTORIZE __attribute__((optimize ("no-tree-slp-vectorize")))
+#else
+#define DONT_SLP_VECTORIZE
+#endif
+
+PyObject* _Py_HOT_FUNCTION DONT_SLP_VECTORIZE
 _PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int throwflag)
 {
     _Py_EnsureTstateNotNULL(tstate);