summaryrefslogtreecommitdiffstats
path: root/compiler/optimizing/instruction_simplifier.cc
diff options
context:
space:
mode:
authorTreehugger Robot <treehugger-gerrit@google.com>2017-11-27 19:53:45 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2017-11-27 19:53:45 +0000
commite1b6d7b8661f4fcaff7bf49348e8644e4a338166 (patch)
tree017a220148b6fd7e95fa07cdbb72861e023b3021 /compiler/optimizing/instruction_simplifier.cc
parent72a3f1da3a300b486626b066e33280108b5ce994 (diff)
parentcebb5e709af5ed5b475a56743f984967d991e7b9 (diff)
downloadart-e1b6d7b8661f4fcaff7bf49348e8644e4a338166.tar.gz
art-e1b6d7b8661f4fcaff7bf49348e8644e4a338166.tar.bz2
art-e1b6d7b8661f4fcaff7bf49348e8644e4a338166.zip
Merge "type conversion elimination for constant input"
Diffstat (limited to 'compiler/optimizing/instruction_simplifier.cc')
-rw-r--r--compiler/optimizing/instruction_simplifier.cc10
1 files changed, 10 insertions, 0 deletions
diff --git a/compiler/optimizing/instruction_simplifier.cc b/compiler/optimizing/instruction_simplifier.cc
index 4c18e16c48..f2e01073b5 100644
--- a/compiler/optimizing/instruction_simplifier.cc
+++ b/compiler/optimizing/instruction_simplifier.cc
@@ -1168,6 +1168,16 @@ void InstructionSimplifierVisitor::VisitTypeConversion(HTypeConversion* instruct
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;
+ }
}
}