summaryrefslogtreecommitdiffstats
path: root/Python/optimizer_analysis.c
diff options
context:
space:
mode:
authorKen Jin <kenjin@python.org>2024-02-15 06:02:18 (GMT)
committerGitHub <noreply@github.com>2024-02-15 06:02:18 (GMT)
commit4ebf8fbdab1c64041ff0ea54b3d15624f6e01511 (patch)
tree513bb5ca87d1adbe7fd086de0e45479e0ec92054 /Python/optimizer_analysis.c
parented23839dc5ce21ea9ca087fac170fa1412005210 (diff)
downloadcpython-4ebf8fbdab1c64041ff0ea54b3d15624f6e01511.zip
cpython-4ebf8fbdab1c64041ff0ea54b3d15624f6e01511.tar.gz
cpython-4ebf8fbdab1c64041ff0ea54b3d15624f6e01511.tar.bz2
gh-115480: Type and constant propagation for int BINARY_OPs (GH-115478)
Diffstat (limited to 'Python/optimizer_analysis.c')
-rw-r--r--Python/optimizer_analysis.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/Python/optimizer_analysis.c b/Python/optimizer_analysis.c
index 4997452..d73bc31 100644
--- a/Python/optimizer_analysis.c
+++ b/Python/optimizer_analysis.c
@@ -341,6 +341,18 @@ sym_new_const(_Py_UOpsAbstractInterpContext *ctx, PyObject *const_val)
return temp;
}
+static inline bool
+is_const(_Py_UOpsSymType *sym)
+{
+ return sym->const_val != NULL;
+}
+
+static inline PyObject *
+get_const(_Py_UOpsSymType *sym)
+{
+ return sym->const_val;
+}
+
static _Py_UOpsSymType*
sym_new_null(_Py_UOpsAbstractInterpContext *ctx)
{