Detect more square patterns

As the one found in the benchmark `slowparts.py'
Can you add a comment : "We use a function to have a different node for each replacement"

Or something like this?