AST generation: remove redundant constraints before determining loop bounds