Fix compiler failure due to error elimination

Fix compiler failure due to error elimination in early_elimination

Issue: https://gitee.com/openharmony/arkcompiler_ets_runtime/issues/I92P92
Signed-off-by: weng-xi <wengxi1@huawei.com>
Change-Id: Idb7c9e6bbd9434dcf04fd522b98b576a6d732e1f
This commit is contained in:
weng-xi 2024-02-22 10:33:57 +08:00
parent a2a5dc4737
commit 3acde2d52a
6 changed files with 82 additions and 0 deletions

View File

@ -379,6 +379,9 @@ bool EarlyElimination::CheckReplacement(GateRef lhs, GateRef rhs)
if (acc_.GetOffset(lhs) != acc_.GetOffset(rhs)) {
return false;
}
if (acc_.GetMachineType(lhs) != acc_.GetMachineType(rhs)) {
return false;
}
if (acc_.GetMemoryOrder(lhs).Value() != acc_.GetMemoryOrder(rhs).Value()) {
return false;
}

View File

@ -197,6 +197,7 @@ group("ark_aot_ts_test") {
"pgo_class_operation",
"pgo_class_prototype",
"pgo_constructor_number",
"pgo_elimination_loadconstoffset",
"pgo_forof_array",
"pgo_forof_map",
"pgo_forof_set",

View File

@ -0,0 +1,20 @@
# Copyright (c) 2024 Huawei Device Co., Ltd.
# 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("//arkcompiler/ets_runtime/test/test_helper.gni")
host_aot_test_action("pgo_elimination_loadconstoffset") {
deps = []
is_only_typed_path = true
is_enable_pgo = true
}

View File

@ -0,0 +1,14 @@
# Copyright (c) 2024 Huawei Device Co., Ltd.
# 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.
run success

View File

@ -0,0 +1,30 @@
/*
* Copyright (c) 2024 Huawei Device Co., Ltd.
* 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.
*/
declare function print(arg:any):string;
function foo(array, flag) {
array.length;
if (flag < 0) {
array[0]; // only Uint8Array type
} else {
array[0]; // only Array type
}
}
let a = new Uint8Array([1,2]);
let a2 = [1,2,3];
foo(a2, 1);
foo(a, -1);
print("run success");

View File

@ -0,0 +1,14 @@
# Copyright (c) 2024 Huawei Device Co., Ltd.
# 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.
run success