19
19
#include " mlir/IR/BuiltinAttributes.h"
20
20
#include " mlir/IR/Dialect.h"
21
21
#include " mlir/IR/OpDefinition.h"
22
+ #include " mlir/IR/Operation.h"
23
+ #include " mlir/IR/OperationSupport.h"
22
24
#include " mlir/IR/TypeUtilities.h"
23
25
#include " mlir/IR/Value.h"
24
26
#include " mlir/Interfaces/ControlFlowInterfaces.h"
28
30
#include " llvm/ADT/STLExtras.h"
29
31
#include " llvm/Support/Casting.h"
30
32
#include " llvm/Support/Debug.h"
33
+ #include " llvm/Support/DebugLog.h"
31
34
#include < cassert>
32
35
#include < optional>
33
36
#include < utility>
@@ -87,7 +90,8 @@ LogicalResult IntegerRangeAnalysis::visitOperation(
87
90
return success ();
88
91
}
89
92
90
- LLVM_DEBUG (llvm::dbgs () << " Inferring ranges for " << *op << " \n " );
93
+ LDBG () << " Inferring ranges for "
94
+ << OpWithFlags (op, OpPrintingFlags ().skipRegions ());
91
95
auto argRanges = llvm::map_to_vector (
92
96
operands, [](const IntegerValueRangeLattice *lattice) {
93
97
return lattice->getValue ();
@@ -99,7 +103,7 @@ LogicalResult IntegerRangeAnalysis::visitOperation(
99
103
return ;
100
104
assert (llvm::is_contained (op->getResults (), result));
101
105
102
- LLVM_DEBUG ( llvm::dbgs ( ) << " Inferred range " << attrs << " \n " ) ;
106
+ LDBG ( ) << " Inferred range " << attrs;
103
107
IntegerValueRangeLattice *lattice = results[result.getResultNumber ()];
104
108
IntegerValueRange oldRange = lattice->getValue ();
105
109
@@ -114,7 +118,7 @@ LogicalResult IntegerRangeAnalysis::visitOperation(
114
118
});
115
119
if (isYieldedResult && !oldRange.isUninitialized () &&
116
120
!(lattice->getValue () == oldRange)) {
117
- LLVM_DEBUG ( llvm::dbgs ( ) << " Loop variant loop result detected\n " ) ;
121
+ LDBG ( ) << " Loop variant loop result detected" ;
118
122
changed |= lattice->join (IntegerValueRange::getMaxRange (v));
119
123
}
120
124
propagateIfChanged (lattice, changed);
@@ -128,7 +132,8 @@ void IntegerRangeAnalysis::visitNonControlFlowArguments(
128
132
Operation *op, const RegionSuccessor &successor,
129
133
ArrayRef<IntegerValueRangeLattice *> argLattices, unsigned firstIndex) {
130
134
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 ());
132
137
133
138
auto argRanges = llvm::map_to_vector (op->getOperands (), [&](Value value) {
134
139
return getLatticeElementFor (getProgramPointAfter (op), value)->getValue ();
@@ -141,7 +146,7 @@ void IntegerRangeAnalysis::visitNonControlFlowArguments(
141
146
if (!llvm::is_contained (successor.getSuccessor ()->getArguments (), arg))
142
147
return ;
143
148
144
- LLVM_DEBUG ( llvm::dbgs ( ) << " Inferred range " << attrs << " \n " ) ;
149
+ LDBG ( ) << " Inferred range " << attrs;
145
150
IntegerValueRangeLattice *lattice = argLattices[arg.getArgNumber ()];
146
151
IntegerValueRange oldRange = lattice->getValue ();
147
152
@@ -156,7 +161,7 @@ void IntegerRangeAnalysis::visitNonControlFlowArguments(
156
161
});
157
162
if (isYieldedValue && !oldRange.isUninitialized () &&
158
163
!(lattice->getValue () == oldRange)) {
159
- LLVM_DEBUG ( llvm::dbgs ( ) << " Loop variant loop result detected\n " ) ;
164
+ LDBG ( ) << " Loop variant loop result detected" ;
160
165
changed |= lattice->join (IntegerValueRange::getMaxRange (v));
161
166
}
162
167
propagateIfChanged (lattice, changed);
0 commit comments