diff options
Diffstat (limited to 'compiler/optimizing')
| -rw-r--r-- | compiler/optimizing/instruction_simplifier.cc | 9 | ||||
| -rw-r--r-- | compiler/optimizing/nodes.h | 4 |
2 files changed, 9 insertions, 4 deletions
diff --git a/compiler/optimizing/instruction_simplifier.cc b/compiler/optimizing/instruction_simplifier.cc index 8daa46c09a..9cfc16f596 100644 --- a/compiler/optimizing/instruction_simplifier.cc +++ b/compiler/optimizing/instruction_simplifier.cc @@ -235,7 +235,10 @@ void InstructionSimplifierVisitor::VisitShift(HBinaryOperation* instruction) { HInstruction* input_other = instruction->GetLeastConstantLeft(); if (input_cst != nullptr) { - if (input_cst->IsZero()) { + int64_t cst = Int64FromConstant(input_cst); + int64_t mask = + (input_other->GetType() == Primitive::kPrimLong) ? kMaxLongShiftValue : kMaxIntShiftValue; + if ((cst & mask) == 0) { // Replace code looking like // SHL dst, src, 0 // with @@ -513,7 +516,9 @@ void InstructionSimplifierVisitor::VisitInstanceOf(HInstanceOf* instruction) { return; } - bool outcome; + // Note: The `outcome` is initialized to please valgrind - the compiler can reorder + // the return value check with the `outcome` check, b/27651442 . + bool outcome = false; if (TypeCheckHasKnownOutcome(load_class, object, &outcome)) { if (outcome && can_be_null) { // Type test will succeed, we just need a null test. diff --git a/compiler/optimizing/nodes.h b/compiler/optimizing/nodes.h index 4ac8f9869f..3733850745 100644 --- a/compiler/optimizing/nodes.h +++ b/compiler/optimizing/nodes.h @@ -2543,7 +2543,7 @@ class HFloatConstant : public HConstant { return bit_cast<uint32_t, float>(value_) == bit_cast<uint32_t, float>((-1.0f)); } bool IsZero() const OVERRIDE { - return value_ == 0.0f; + return bit_cast<uint32_t, float>(value_) == bit_cast<uint32_t, float>(0.0f); } bool IsOne() const OVERRIDE { return bit_cast<uint32_t, float>(value_) == bit_cast<uint32_t, float>(1.0f); @@ -2585,7 +2585,7 @@ class HDoubleConstant : public HConstant { return bit_cast<uint64_t, double>(value_) == bit_cast<uint64_t, double>((-1.0)); } bool IsZero() const OVERRIDE { - return value_ == 0.0; + return bit_cast<uint64_t, double>(value_) == bit_cast<uint64_t, double>((0.0)); } bool IsOne() const OVERRIDE { return bit_cast<uint64_t, double>(value_) == bit_cast<uint64_t, double>(1.0); |