diff options
-rw-r--r-- | compiler/optimizing/nodes_vector.h | 5 | ||||
-rw-r--r-- | test/682-double-catch-phi/expected.txt | 1 | ||||
-rw-r--r-- | test/682-double-catch-phi/info.txt | 1 | ||||
-rw-r--r-- | test/682-double-catch-phi/smali/DoubleCatchPhi.smali | 47 | ||||
-rw-r--r-- | test/682-double-catch-phi/src/Main.java | 26 |
5 files changed, 79 insertions, 1 deletions
diff --git a/compiler/optimizing/nodes_vector.h b/compiler/optimizing/nodes_vector.h index 9b114eb1f7..1a484e1944 100644 --- a/compiler/optimizing/nodes_vector.h +++ b/compiler/optimizing/nodes_vector.h @@ -171,9 +171,12 @@ class HVecOperation : public HVariableInputSizeInstruction { if (instruction->IsVecOperation()) { return !instruction->IsVecExtractScalar(); // only scalar returning vec op } else if (instruction->IsPhi()) { + // Vectorizer only uses Phis in reductions, so checking for a 2-way phi + // with a direct vector operand as second argument suffices. return instruction->GetType() == kSIMDType && - instruction->InputAt(1)->IsVecOperation(); // vectorizer does not go deeper + instruction->InputCount() == 2 && + instruction->InputAt(1)->IsVecOperation(); } return false; } diff --git a/test/682-double-catch-phi/expected.txt b/test/682-double-catch-phi/expected.txt new file mode 100644 index 0000000000..b0aad4deb5 --- /dev/null +++ b/test/682-double-catch-phi/expected.txt @@ -0,0 +1 @@ +passed diff --git a/test/682-double-catch-phi/info.txt b/test/682-double-catch-phi/info.txt new file mode 100644 index 0000000000..0ef2e59e9b --- /dev/null +++ b/test/682-double-catch-phi/info.txt @@ -0,0 +1 @@ +Regression test on double-typed catch phi diff --git a/test/682-double-catch-phi/smali/DoubleCatchPhi.smali b/test/682-double-catch-phi/smali/DoubleCatchPhi.smali new file mode 100644 index 0000000000..1d3f927bb2 --- /dev/null +++ b/test/682-double-catch-phi/smali/DoubleCatchPhi.smali @@ -0,0 +1,47 @@ +# Copyright (C) 2018 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +.class public LDoubleCatchPhi; + +.super Ljava/lang/Object; + +.field public mValue:D + +.method public constructor <init>()V +.registers 1 + invoke-direct {v0}, Ljava/lang/Object;-><init>()V + return-void +.end method + +.method public strangeMethod(F)V +.registers 6 + move-object v2, v4 + monitor-enter v4 +:try_start1 + float-to-double v0, v5 + iput-wide v0, v4, LDoubleCatchPhi;->mValue:D + monitor-exit v2 +:try_end1 + goto :end_catch +:catch +:try_start2 + move-exception v3 + monitor-exit v2 +:try_end2 + throw v3 +:end_catch + return-void +.catchall {:try_start1 .. :try_end1} :catch +.catchall {:try_start2 .. :try_end2} :catch +.end method diff --git a/test/682-double-catch-phi/src/Main.java b/test/682-double-catch-phi/src/Main.java new file mode 100644 index 0000000000..e65bf0d4d4 --- /dev/null +++ b/test/682-double-catch-phi/src/Main.java @@ -0,0 +1,26 @@ +/* + * Copyright (C) 2018 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import java.lang.reflect.Method; + +public class Main { + public static void main(String[] args) throws Exception { + if (System.getProperty("java.vm.name").equals("Dalvik")) { + Class<?> c = Class.forName("DoubleCatchPhi"); + } + System.out.println("passed"); + } +} |