Optimizes an AST to identify special gate cases.