Merge "Minor improvements to 458-checker-instruction-simplification."
diff --git a/compiler/optimizing/constant_folding.h b/compiler/optimizing/constant_folding.h
index ac00824..66ff578 100644
--- a/compiler/optimizing/constant_folding.h
+++ b/compiler/optimizing/constant_folding.h
@@ -32,8 +32,8 @@
*/
class HConstantFolding : public HOptimization {
public:
- explicit HConstantFolding(HGraph* graph)
- : HOptimization(graph, true, kConstantFoldingPassName) {}
+ explicit HConstantFolding(HGraph* graph, const char* name = kConstantFoldingPassName)
+ : HOptimization(graph, true, name) {}
void Run() OVERRIDE;
diff --git a/compiler/optimizing/optimizing_compiler.cc b/compiler/optimizing/optimizing_compiler.cc
index d99d359..05451bc 100644
--- a/compiler/optimizing/optimizing_compiler.cc
+++ b/compiler/optimizing/optimizing_compiler.cc
@@ -328,7 +328,7 @@
HInliner inliner(graph, dex_compilation_unit, dex_compilation_unit, driver, stats);
- HConstantFolding fold2(graph);
+ HConstantFolding fold2(graph, "constant_folding_after_inlining");
SideEffectsAnalysis side_effects(graph);
GVNOptimization gvn(graph, side_effects);
LICM licm(graph, side_effects);
diff --git a/test/458-checker-instruction-simplification/src/Main.java b/test/458-checker-instruction-simplification/src/Main.java
index 65be6cb..f0578ef 100644
--- a/test/458-checker-instruction-simplification/src/Main.java
+++ b/test/458-checker-instruction-simplification/src/Main.java
@@ -374,6 +374,15 @@
// CHECK-DAG: [[Or:i\d+]] Or [ [[Add1]] [[Add2]] ]
// CHECK-DAG: Return [ [[Or]] ]
+ // CHECK-START: int Main.AddNegs2(int, int) GVN (after)
+ // CHECK-DAG: [[Arg1:i\d+]] ParameterValue
+ // CHECK-DAG: [[Arg2:i\d+]] ParameterValue
+ // CHECK-DAG: [[Neg1:i\d+]] Neg [ [[Arg1]] ]
+ // CHECK-DAG: [[Neg2:i\d+]] Neg [ [[Arg2]] ]
+ // CHECK-DAG: [[Add:i\d+]] Add [ [[Neg1]] [[Neg2]] ]
+ // CHECK-DAG: [[Or:i\d+]] Or [ [[Add]] [[Add]] ]
+ // CHECK-DAG: Return [ [[Or]] ]
+
public static int AddNegs2(int arg1, int arg2) {
int temp1 = -arg1;
int temp2 = -arg2;
@@ -530,6 +539,12 @@
// CHECK-NOT: Neg
// CHECK-NOT: Add
+ // CHECK-START: int Main.NegNeg2(int) constant_folding_after_inlining (after)
+ // CHECK: [[Const0:i\d+]] IntConstant 0
+ // CHECK-NOT: Neg
+ // CHECK-NOT: Add
+ // CHECK: Return [ [[Const0]] ]
+
public static int NegNeg2(int arg) {
int temp = -arg;
return temp + -temp;