1919#include " mlir/IR/BuiltinAttributes.h"
2020#include " mlir/IR/Dialect.h"
2121#include " mlir/IR/OpDefinition.h"
22+ #include " mlir/IR/Operation.h"
23+ #include " mlir/IR/OperationSupport.h"
2224#include " mlir/IR/TypeUtilities.h"
2325#include " mlir/IR/Value.h"
2426#include " mlir/Interfaces/ControlFlowInterfaces.h"
2830#include " llvm/ADT/STLExtras.h"
2931#include " llvm/Support/Casting.h"
3032#include " llvm/Support/Debug.h"
33+ #include " llvm/Support/DebugLog.h"
3134#include < cassert>
3235#include < optional>
3336#include < utility>
@@ -87,7 +90,8 @@ LogicalResult IntegerRangeAnalysis::visitOperation(
8790 return success ();
8891 }
8992
90- LLVM_DEBUG (llvm::dbgs () << " Inferring ranges for " << *op << " \n " );
93+ LDBG () << " Inferring ranges for "
94+ << OpWithFlags (op, OpPrintingFlags ().skipRegions ());
9195 auto argRanges = llvm::map_to_vector (
9296 operands, [](const IntegerValueRangeLattice *lattice) {
9397 return lattice->getValue ();
@@ -99,7 +103,7 @@ LogicalResult IntegerRangeAnalysis::visitOperation(
99103 return ;
100104 assert (llvm::is_contained (op->getResults (), result));
101105
102- LLVM_DEBUG ( llvm::dbgs ( ) << " Inferred range " << attrs << " \n " ) ;
106+ LDBG ( ) << " Inferred range " << attrs;
103107 IntegerValueRangeLattice *lattice = results[result.getResultNumber ()];
104108 IntegerValueRange oldRange = lattice->getValue ();
105109
@@ -114,7 +118,7 @@ LogicalResult IntegerRangeAnalysis::visitOperation(
114118 });
115119 if (isYieldedResult && !oldRange.isUninitialized () &&
116120 !(lattice->getValue () == oldRange)) {
117- LLVM_DEBUG ( llvm::dbgs ( ) << " Loop variant loop result detected\n " ) ;
121+ LDBG ( ) << " Loop variant loop result detected" ;
118122 changed |= lattice->join (IntegerValueRange::getMaxRange (v));
119123 }
120124 propagateIfChanged (lattice, changed);
@@ -128,7 +132,8 @@ void IntegerRangeAnalysis::visitNonControlFlowArguments(
128132 Operation *op, const RegionSuccessor &successor,
129133 ArrayRef<IntegerValueRangeLattice *> argLattices, unsigned firstIndex) {
130134 if (auto inferrable = dyn_cast<InferIntRangeInterface>(op)) {
131- LLVM_DEBUG (llvm::dbgs () << " Inferring ranges for " << *op << " \n " );
135+ LDBG () << " Inferring ranges for "
136+ << OpWithFlags (op, OpPrintingFlags ().skipRegions ());
132137
133138 auto argRanges = llvm::map_to_vector (op->getOperands (), [&](Value value) {
134139 return getLatticeElementFor (getProgramPointAfter (op), value)->getValue ();
@@ -141,7 +146,7 @@ void IntegerRangeAnalysis::visitNonControlFlowArguments(
141146 if (!llvm::is_contained (successor.getSuccessor ()->getArguments (), arg))
142147 return ;
143148
144- LLVM_DEBUG ( llvm::dbgs ( ) << " Inferred range " << attrs << " \n " ) ;
149+ LDBG ( ) << " Inferred range " << attrs;
145150 IntegerValueRangeLattice *lattice = argLattices[arg.getArgNumber ()];
146151 IntegerValueRange oldRange = lattice->getValue ();
147152
@@ -156,7 +161,7 @@ void IntegerRangeAnalysis::visitNonControlFlowArguments(
156161 });
157162 if (isYieldedValue && !oldRange.isUninitialized () &&
158163 !(lattice->getValue () == oldRange)) {
159- LLVM_DEBUG ( llvm::dbgs ( ) << " Loop variant loop result detected\n " ) ;
164+ LDBG ( ) << " Loop variant loop result detected" ;
160165 changed |= lattice->join (IntegerValueRange::getMaxRange (v));
161166 }
162167 propagateIfChanged (lattice, changed);
0 commit comments