Optimizing: Clean up constant location handling.

Locations builder should use ConstantLocation() when the
code generator relies on a location to be constant. Code
generator should interrogate locations, not inputs, about
being const.

Change-Id: Ic35bb84aa9f83e0977b151a0430aca6c88f19cf0
diff --git a/compiler/optimizing/code_generator_x86.cc b/compiler/optimizing/code_generator_x86.cc
index 8308d9e..cc6f7d3 100644
--- a/compiler/optimizing/code_generator_x86.cc
+++ b/compiler/optimizing/code_generator_x86.cc
@@ -3014,7 +3014,7 @@
       DCHECK_EQ(EAX, first.AsRegister<Register>());
       DCHECK_EQ(is_div ? EAX : EDX, out.AsRegister<Register>());
 
-      if (instruction->InputAt(1)->IsIntConstant()) {
+      if (second.IsConstant()) {
         int32_t imm = second.GetConstant()->AsIntConstant()->GetValue();
 
         if (imm == 0) {