Have the asmprinter give true/false constants nice names, add a dump/print
method to SSAValue.

PiperOrigin-RevId: 207193088
diff --git a/lib/IR/AsmPrinter.cpp b/lib/IR/AsmPrinter.cpp
index 221f453..6177e19 100644
--- a/lib/IR/AsmPrinter.cpp
+++ b/lib/IR/AsmPrinter.cpp
@@ -594,9 +594,14 @@
     // Give constant integers special names.
     if (auto *op = value->getDefiningOperation()) {
       if (auto intOp = op->getAs<ConstantIntOp>()) {
-        specialName << 'c' << intOp->getValue();
-        if (!intOp->getType()->isAffineInt())
-          specialName << '_' << *intOp->getType();
+        // i1 constants get special names.
+        if (intOp->getType()->isInteger(1)) {
+          specialName << (intOp->getValue() ? "true" : "false");
+        } else {
+          specialName << 'c' << intOp->getValue();
+          if (!intOp->getType()->isAffineInt())
+            specialName << '_' << *intOp->getType();
+        }
       }
     }
 
@@ -1151,6 +1156,27 @@
   ModulePrinter(os, state).printAffineMap(this);
 }
 
+void SSAValue::print(raw_ostream &os) const {
+  switch (getKind()) {
+  case SSAValueKind::BBArgument:
+    // TODO: Improve this.
+    os << "<bb argument>\n";
+    return;
+  case SSAValueKind::InstResult:
+    return getDefiningInst()->print(os);
+  case SSAValueKind::FnArgument:
+    // TODO: Improve this.
+    os << "<function argument>\n";
+    return;
+  case SSAValueKind::StmtResult:
+    return getDefiningStmt()->print(os);
+  case SSAValueKind::ForStmt:
+    return cast<ForStmt>(this)->print(os);
+  }
+}
+
+void SSAValue::dump() const { print(llvm::errs()); }
+
 void Instruction::print(raw_ostream &os) const {
   ModuleState state(getFunction()->getContext());
   ModulePrinter modulePrinter(os, state);