aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Python
diff options
context:
space:
mode:
authormpage <mpage@meta.com>2025-04-09 10:34:12 -0700
committerGitHub <noreply@github.com>2025-04-09 10:34:12 -0700
commit1f5682f3a27516833f7c317707dd359280dba6e7 (patch)
tree0cd8df35732c9d441c9405156f5308027ae25eaf /Python
parent67ded6a4faae29edff8e4f7886978e71ce116e33 (diff)
downloadcpython-1f5682f3a27516833f7c317707dd359280dba6e7.tar.gz
cpython-1f5682f3a27516833f7c317707dd359280dba6e7.zip
gh-129987: Disable GCC SLP autovectorization for the interpreter loop on x86-64 (#132295)
The SLP autovectorizer can cause poor code generation for opcode dispatch, negating any benefit we get from vectorization elsewhere in the interpreter loop.
Diffstat (limited to 'Python')
-rw-r--r--Python/ceval.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/Python/ceval.c b/Python/ceval.c
index a59b2b7a168..47d068edac2 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -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);