Make the SSA builder honor the debuggable flag.

This requires to properly type phis that are only
used by environments, and discard phis with incomptable types.
The code generators do not handle these conflicting types. In
the process, ensure a phi has a type that does not depend
on the order of the inputs (for example (char, short) -> short),
and set int for int-like types. We can refine this later.

Change-Id: I60ab601d6d00b1cbf18623ee4ff1795aa28f84a1
diff --git a/compiler/optimizing/graph_checker.cc b/compiler/optimizing/graph_checker.cc
index a7f1f74..76b9f4f 100644
--- a/compiler/optimizing/graph_checker.cc
+++ b/compiler/optimizing/graph_checker.cc
@@ -362,6 +362,12 @@
             Primitive::PrettyDescriptor(phi->GetType())));
     }
   }
+  if (phi->GetType() != HPhi::ToPhiType(phi->GetType())) {
+    AddError(StringPrintf("Phi %d in block %d does not have an expected phi type: %s",
+                          phi->GetId(),
+                          phi->GetBlock()->GetBlockId(),
+                          Primitive::PrettyDescriptor(phi->GetType())));
+  }
 }
 
 void SSAChecker::VisitIf(HIf* instruction) {