summaryrefslogtreecommitdiff
path: root/compiler/optimizing/nodes.cc
diff options
context:
space:
mode:
author Roland Levillain <rpl@google.com> 2014-12-11 12:14:33 +0000
committer Roland Levillain <rpl@google.com> 2015-08-05 11:01:40 +0100
commitc90bc7c07f9bd24b5424cfb1e3f064fbae5334d6 (patch)
treea462fa0cc21489d4250febb6d098aacc7a265279 /compiler/optimizing/nodes.cc
parentc2abe2fe9036b57c581e3003d0b820d1c54dbd30 (diff)
Add constant folding for long unary operations in opt. compiler.
Add tests to exercise the constant folding of these instructions. Also, prevent Java methods from run-tests exercising the code generation of these instruction from being inlined, so that they continue to check the generated code (and not the code produced by the constant folding pass). Change-Id: I28efca7cdb5142ac2b6d158ba296fb9136d62481
Diffstat (limited to 'compiler/optimizing/nodes.cc')
-rw-r--r--compiler/optimizing/nodes.cc8
1 files changed, 2 insertions, 6 deletions
diff --git a/compiler/optimizing/nodes.cc b/compiler/optimizing/nodes.cc
index 296c1b02fc..efaf48cc9f 100644
--- a/compiler/optimizing/nodes.cc
+++ b/compiler/optimizing/nodes.cc
@@ -1008,12 +1008,8 @@ HConstant* HUnaryOperation::TryStaticEvaluation() const {
int32_t value = Evaluate(GetInput()->AsIntConstant()->GetValue());
return GetBlock()->GetGraph()->GetIntConstant(value);
} else if (GetInput()->IsLongConstant()) {
- // TODO: Implement static evaluation of long unary operations.
- //
- // Do not exit with a fatal condition here. Instead, simply
- // return `null' to notify the caller that this instruction
- // cannot (yet) be statically evaluated.
- return nullptr;
+ int64_t value = Evaluate(GetInput()->AsLongConstant()->GetValue());
+ return GetBlock()->GetGraph()->GetLongConstant(value);
}
return nullptr;
}