Kaynağa Gözat

Merge pull request #1870 from ghalliday/csefix

Improve cse inside nodes that can't create temps

Reviewed-By: Renato Golin <rengolin@hpccsystems.com>
Reviewed-By: Richard Chapman <rchapman@hpccsystems.com>
Richard Chapman 13 yıl önce
ebeveyn
işleme
8946849bd9
1 değiştirilmiş dosya ile 23 ekleme ve 2 silme
  1. 23 2
      ecl/hqlcpp/hqlcse.cpp

+ 23 - 2
ecl/hqlcpp/hqlcse.cpp

@@ -241,11 +241,32 @@ void CseSpotter::analyseExpr(IHqlExpression * expr)
         extra->alreadyAliased = true;
     }
 
+    switch (op)
+    {
+    case no_assign:
+    case no_transform:
+    case no_newtransform:
+    case no_range:
+    case no_rangefrom:
+        if (expr->isConstant())
+            return;
+        break;
+    case no_constant:
+        return;
+    }
+
     if (extra->numRefs++ != 0)
     {
-        if (!spottedCandidate && extra->worthAliasing() && (op != no_alias))
+        if (op == no_alias)
+            return;
+        if (!spottedCandidate && extra->worthAliasing())
             spottedCandidate = true;
-        //if (canCreateTemporary(expr))
+        if (canCreateTemporary(expr))
+            return;
+
+        //Ugly! This is here as a temporary hack to stop branches of maps being commoned up and always
+        //evaluated.  The alias spotting and generation really needs to take conditionality into account....
+        if (op == no_mapto)
             return;
     }