diff options
| author | 2015-05-18 14:22:09 +0100 | |
|---|---|---|
| committer | 2015-05-18 19:15:52 +0100 | |
| commit | 07276db28d654594e0e86e9e467cad393f752e6e (patch) | |
| tree | 6450e07d64045f0c0949b3423501316b672641c7 /compiler/optimizing/instruction_simplifier.cc | |
| parent | 17f1bc531ea2f8c1a6fac3def13dee1b901949dd (diff) | |
Don't do a null test in MarkGCCard if the value cannot be null.
Change-Id: I45687f6d3505178e2fc3689eac9cb6ab1b2c1e29
Diffstat (limited to 'compiler/optimizing/instruction_simplifier.cc')
| -rw-r--r-- | compiler/optimizing/instruction_simplifier.cc | 22 | 
1 files changed, 22 insertions, 0 deletions
diff --git a/compiler/optimizing/instruction_simplifier.cc b/compiler/optimizing/instruction_simplifier.cc index 46fad17b8f..0adb931158 100644 --- a/compiler/optimizing/instruction_simplifier.cc +++ b/compiler/optimizing/instruction_simplifier.cc @@ -45,6 +45,8 @@ class InstructionSimplifierVisitor : public HGraphVisitor {    void VisitEqual(HEqual* equal) OVERRIDE;    void VisitNotEqual(HNotEqual* equal) OVERRIDE;    void VisitBooleanNot(HBooleanNot* bool_not) OVERRIDE; +  void VisitInstanceFieldSet(HInstanceFieldSet* equal) OVERRIDE; +  void VisitStaticFieldSet(HStaticFieldSet* equal) OVERRIDE;    void VisitArraySet(HArraySet* equal) OVERRIDE;    void VisitTypeConversion(HTypeConversion* instruction) OVERRIDE;    void VisitNullCheck(HNullCheck* instruction) OVERRIDE; @@ -78,6 +80,8 @@ void InstructionSimplifier::Run() {  }  void InstructionSimplifierVisitor::Run() { +  // Iterate in reverse post order to open up more simplifications to users +  // of instructions that got simplified.    for (HReversePostOrderIterator it(*GetGraph()); !it.Done();) {      // The simplification of an instruction to another instruction may yield      // possibilities for other simplifications. So although we perform a reverse @@ -199,6 +203,20 @@ void InstructionSimplifierVisitor::VisitInstanceOf(HInstanceOf* instruction) {    }  } +void InstructionSimplifierVisitor::VisitInstanceFieldSet(HInstanceFieldSet* instruction) { +  if ((instruction->GetValue()->GetType() == Primitive::kPrimNot) +      && !instruction->GetValue()->CanBeNull()) { +    instruction->ClearValueCanBeNull(); +  } +} + +void InstructionSimplifierVisitor::VisitStaticFieldSet(HStaticFieldSet* instruction) { +  if ((instruction->GetValue()->GetType() == Primitive::kPrimNot) +      && !instruction->GetValue()->CanBeNull()) { +    instruction->ClearValueCanBeNull(); +  } +} +  void InstructionSimplifierVisitor::VisitSuspendCheck(HSuspendCheck* check) {    HBasicBlock* block = check->GetBlock();    // Currently always keep the suspend check at entry. @@ -294,6 +312,10 @@ void InstructionSimplifierVisitor::VisitArraySet(HArraySet* instruction) {        instruction->ClearNeedsTypeCheck();      }    } + +  if (!value->CanBeNull()) { +    instruction->ClearValueCanBeNull(); +  }  }  void InstructionSimplifierVisitor::VisitTypeConversion(HTypeConversion* instruction) {  |