From 7b7bfc78d10f748e6107f31ff33c723b20815efb Mon Sep 17 00:00:00 2001
From: Andreas Kloeckner <inform@tiker.net>
Date: Mon, 2 Apr 2012 19:29:04 -0400
Subject: [PATCH] Warn against obvious-looking (but dangerous) code mod in
 pymbolic.cse.

---
 pymbolic/cse.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/pymbolic/cse.py b/pymbolic/cse.py
index 700479a..9329a69 100644
--- a/pymbolic/cse.py
+++ b/pymbolic/cse.py
@@ -68,7 +68,10 @@ class CSEMapper(IdentityMapper):
     map_call = map_sum
 
     def map_common_subexpression(self, expr):
-        # don't duplicate CSEs
+        # Avoid creating CSE(CSE(...))
+        #
+        # NOTE: This is not equivalent to isinstance--it's more specific,
+        # and for a reason!
         if type(expr) is prim.CommonSubexpression:
             return prim.wrap_in_cse(self.rec(expr.child), expr.prefix)
         else:
-- 
GitLab