Refactor removeDuplicateGradients to loop until it reaches a fixed point
Refactor removeDuplicateGradients to loop until it reaches a fixed point

This is commits enables a future optimization (but is not a notable
optimization in itself).

Signed-off-by: Niels Thykier <a802a5730c0da02a06106670cc12c7838c6e90dc@thykier.net>

scour-project/scour,Ede123/scour,codedread/scour,oberstet/scour