summaryrefslogtreecommitdiff
path: root/compiler/optimizing/instruction_simplifier.cc
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/optimizing/instruction_simplifier.cc')
-rw-r--r--compiler/optimizing/instruction_simplifier.cc9
1 files changed, 9 insertions, 0 deletions
diff --git a/compiler/optimizing/instruction_simplifier.cc b/compiler/optimizing/instruction_simplifier.cc
index 63bc4ae671..17c8f337ca 100644
--- a/compiler/optimizing/instruction_simplifier.cc
+++ b/compiler/optimizing/instruction_simplifier.cc
@@ -27,6 +27,7 @@ class InstructionSimplifierVisitor : public HGraphVisitor {
void VisitEqual(HEqual* equal) OVERRIDE;
void VisitArraySet(HArraySet* equal) OVERRIDE;
void VisitTypeConversion(HTypeConversion* instruction) OVERRIDE;
+ void VisitNullCheck(HNullCheck* instruction) OVERRIDE;
};
void InstructionSimplifier::Run() {
@@ -34,6 +35,14 @@ void InstructionSimplifier::Run() {
visitor.VisitInsertionOrder();
}
+void InstructionSimplifierVisitor::VisitNullCheck(HNullCheck* null_check) {
+ HInstruction* obj = null_check->InputAt(0);
+ if (!obj->CanBeNull()) {
+ null_check->ReplaceWith(obj);
+ null_check->GetBlock()->RemoveInstruction(null_check);
+ }
+}
+
void InstructionSimplifierVisitor::VisitSuspendCheck(HSuspendCheck* check) {
HBasicBlock* block = check->GetBlock();
// Currently always keep the suspend check at entry.