diff --git a/mlir/lib/Analysis/DataFlow/IntegerRangeAnalysis.cpp b/mlir/lib/Analysis/DataFlow/IntegerRangeAnalysis.cpp index c7a950d9a8871..e79f6a8aec1cf 100644 --- a/mlir/lib/Analysis/DataFlow/IntegerRangeAnalysis.cpp +++ b/mlir/lib/Analysis/DataFlow/IntegerRangeAnalysis.cpp @@ -19,6 +19,8 @@ #include "mlir/IR/BuiltinAttributes.h" #include "mlir/IR/Dialect.h" #include "mlir/IR/OpDefinition.h" +#include "mlir/IR/Operation.h" +#include "mlir/IR/OperationSupport.h" #include "mlir/IR/TypeUtilities.h" #include "mlir/IR/Value.h" #include "mlir/Interfaces/ControlFlowInterfaces.h" @@ -28,6 +30,7 @@ #include "llvm/ADT/STLExtras.h" #include "llvm/Support/Casting.h" #include "llvm/Support/Debug.h" +#include "llvm/Support/DebugLog.h" #include #include #include @@ -87,7 +90,8 @@ LogicalResult IntegerRangeAnalysis::visitOperation( return success(); } - LLVM_DEBUG(llvm::dbgs() << "Inferring ranges for " << *op << "\n"); + LDBG() << "Inferring ranges for " + << OpWithFlags(op, OpPrintingFlags().skipRegions()); auto argRanges = llvm::map_to_vector( operands, [](const IntegerValueRangeLattice *lattice) { return lattice->getValue(); @@ -99,7 +103,7 @@ LogicalResult IntegerRangeAnalysis::visitOperation( return; assert(llvm::is_contained(op->getResults(), result)); - LLVM_DEBUG(llvm::dbgs() << "Inferred range " << attrs << "\n"); + LDBG() << "Inferred range " << attrs; IntegerValueRangeLattice *lattice = results[result.getResultNumber()]; IntegerValueRange oldRange = lattice->getValue(); @@ -114,7 +118,7 @@ LogicalResult IntegerRangeAnalysis::visitOperation( }); if (isYieldedResult && !oldRange.isUninitialized() && !(lattice->getValue() == oldRange)) { - LLVM_DEBUG(llvm::dbgs() << "Loop variant loop result detected\n"); + LDBG() << "Loop variant loop result detected"; changed |= lattice->join(IntegerValueRange::getMaxRange(v)); } propagateIfChanged(lattice, changed); @@ -128,7 +132,8 @@ void IntegerRangeAnalysis::visitNonControlFlowArguments( Operation *op, const RegionSuccessor &successor, ArrayRef argLattices, unsigned firstIndex) { if (auto inferrable = dyn_cast(op)) { - LLVM_DEBUG(llvm::dbgs() << "Inferring ranges for " << *op << "\n"); + LDBG() << "Inferring ranges for " + << OpWithFlags(op, OpPrintingFlags().skipRegions()); auto argRanges = llvm::map_to_vector(op->getOperands(), [&](Value value) { return getLatticeElementFor(getProgramPointAfter(op), value)->getValue(); @@ -141,7 +146,7 @@ void IntegerRangeAnalysis::visitNonControlFlowArguments( if (!llvm::is_contained(successor.getSuccessor()->getArguments(), arg)) return; - LLVM_DEBUG(llvm::dbgs() << "Inferred range " << attrs << "\n"); + LDBG() << "Inferred range " << attrs; IntegerValueRangeLattice *lattice = argLattices[arg.getArgNumber()]; IntegerValueRange oldRange = lattice->getValue(); @@ -156,7 +161,7 @@ void IntegerRangeAnalysis::visitNonControlFlowArguments( }); if (isYieldedValue && !oldRange.isUninitialized() && !(lattice->getValue() == oldRange)) { - LLVM_DEBUG(llvm::dbgs() << "Loop variant loop result detected\n"); + LDBG() << "Loop variant loop result detected"; changed |= lattice->join(IntegerValueRange::getMaxRange(v)); } propagateIfChanged(lattice, changed);