static boolean ignoresInput(Expression exp) {
        if (exp instanceof SwitchExpression || exp instanceof ScriptExpression || exp instanceof ForEachExpression) {
            return false;  // Switch and script never ignores input.
        }
        if (exp instanceof CompositeExpression) {
            return new IgnoresInputVisitor().ignoresInput(exp);
        }
        if (exp instanceof RandomExpression) {
            return ((RandomExpression)exp).getMaxValue() != null;
        }
        return exp instanceof InputExpression ||
               exp instanceof NowExpression ||
               exp instanceof ConstantExpression ||
               exp instanceof HostNameExpression ||
               exp instanceof GetVarExpression;
    }
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