type conversion elimination for constant input

type conversion on constant input can be eliminated if the constant
value falls in the result type's range.

Test: run-test on host, 711-checker-type-conversion
Change-Id: I372139d681aa06fa6e760d7814c86ac949292813
diff --git a/compiler/optimizing/instruction_simplifier.cc b/compiler/optimizing/instruction_simplifier.cc
index fbfee12..a6dfa47 100644
--- a/compiler/optimizing/instruction_simplifier.cc
+++ b/compiler/optimizing/instruction_simplifier.cc
@@ -1159,6 +1159,16 @@
       RecordSimplification();
       return;
     }
+  } else if (input->IsIntConstant()) {
+    // Try to eliminate type conversion on int constant whose value falls into
+    // the range of the result type.
+    int32_t value = input->AsIntConstant()->GetValue();
+    if (DataType::IsTypeConversionImplicit(value, result_type)) {
+      instruction->ReplaceWith(input);
+      instruction->GetBlock()->RemoveInstruction(instruction);
+      RecordSimplification();
+      return;
+    }
   }
 }