diff --git a/mlir/lib/Analysis/DataFlow/IntegerRangeAnalysis.cpp b/mlir/lib/Analysis/DataFlow/IntegerRangeAnalysis.cpp --- a/mlir/lib/Analysis/DataFlow/IntegerRangeAnalysis.cpp +++ b/mlir/lib/Analysis/DataFlow/IntegerRangeAnalysis.cpp @@ -128,6 +128,11 @@ ArrayRef argLattices, unsigned firstIndex) { if (auto inferrable = dyn_cast(op)) { LLVM_DEBUG(llvm::dbgs() << "Inferring ranges for " << *op << "\n"); + // If the lattice on any operand is unitialized, bail out. + if (llvm::any_of(op->getOperands(), [&](Value value) { + return getLatticeElementFor(op, value)->getValue().isUninitialized(); + })) + return; SmallVector argRanges( llvm::map_range(op->getOperands(), [&](Value value) { return getLatticeElementFor(op, value)->getValue().getValue();