Enhance ConstantIntOp to work with AffineInt, move use/def list processing code
into a more logical header.

PiperOrigin-RevId: 206175435
diff --git a/lib/IR/StandardOps.cpp b/lib/IR/StandardOps.cpp
index 069f3ed..104ff2e 100644
--- a/lib/IR/StandardOps.cpp
+++ b/lib/IR/StandardOps.cpp
@@ -73,10 +73,12 @@
   return "requires a result type that aligns with the 'value' attribute";
 }
 
-/// ConstantIntOp only matches values whose result type is an IntegerType.
+/// ConstantIntOp only matches values whose result type is an IntegerType or
+/// AffineInt.
 bool ConstantIntOp::isClassFor(const Operation *op) {
   return ConstantOp::isClassFor(op) &&
-         isa<IntegerType>(op->getResult(0)->getType());
+         (isa<IntegerType>(op->getResult(0)->getType()) ||
+          op->getResult(0)->getType()->isAffineInt());
 }
 
 void DimOp::print(OpAsmPrinter *p) const {