Check trivial loops in operation creation

This checks for a trivial sort of loop: that the destination of an
operation matches with any of its sources.  This is super cheap to do
and found a bug, so I figure it's worth keeping.