@Override
    public void process(boolean validate, boolean documentsOnly) {
        for (SDField field : schema.allConcreteFields()) {
            ScriptExpression script = field.getIndexingScript();
            if (script == null) continue;

            field.setIndexingScript(schema.getName(), (ScriptExpression)new ExpressionOptimizer().convert(script));
            if ( ! field.getIndexingScript().toString().equals(script.toString())) {
                info(schema, field, "Rewrote ilscript from:\n" + script.toString() +
                                    "\nto\n" + field.getIndexingScript().toString());
            }
        }
    }
Run ExpressionOptimizer on all scripts, to get rid of expressions that have no effect.
config-model/src/main/java/com/yahoo/schema/processing/OptimizeIlscript.java