tensorflow / mlir

"Multi-Level Intermediate Representation" Compiler Infrastructure
1.73k stars 257 forks source link

mlir::replaceAllUsesExcept bug #291

Closed bondhugula closed 4 years ago

bondhugula commented 4 years ago

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.

ftynse commented 4 years ago

Thanks for the report, a fix is coming.