From c90bc7c07f9bd24b5424cfb1e3f064fbae5334d6 Mon Sep 17 00:00:00 2001 From: Roland Levillain Date: Thu, 11 Dec 2014 12:14:33 +0000 Subject: 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 --- compiler/optimizing/nodes.cc | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'compiler/optimizing/nodes.cc') 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; } -- cgit v1.2.3-59-g8ed1b