static boolean hasSideEffect(Expression exp) {
        HasSideEffectVisitor visitor = new HasSideEffectVisitor();
        visitor.visit(exp);
        return visitor.hasSideEffect;
    }
Optimizes expressions by removing expressions that have no effect.
Typical examples are statements that come before a statement that
generates a new execution value without regard for the existing one.
indexinglanguage/src/main/java/com/yahoo/vespa/indexinglanguage/ExpressionOptimizer.java