The above iteration would be incorrect and requires:
orig->getUses() -> llvm::make_early_inc_range(orig->getUses())
The use list nodes (IROperands) have next/prev links, and so this iteration would be chasing the wrong use list post a use update. It would miss uses to update as well as update the wrong uses. (I have a client that exposes this bug in a larger pass but that would take a week or so to be submitted.) It's probably easier for the author @ftynse to add a test case if this has to be fixed in the interim.
https://github.com/tensorflow/mlir/blob/7eba47b9073346bc84827ad744a275451c098fd8/lib/Transforms/Utils/LoopUtils.cpp#L979-L984
The above iteration would be incorrect and requires:
orig->getUses()
->llvm::make_early_inc_range(orig->getUses())
The use list nodes (IROperands) have next/prev links, and so this iteration would be chasing the wrong use list post a use update. It would miss uses to update as well as update the wrong uses. (I have a client that exposes this bug in a larger pass but that would take a week or so to be submitted.) It's probably easier for the author @ftynse to add a test case if this has to be fixed in the interim.