1 /*
2  * Copyright (c) 2024 Shenzhen Kaihong Digital Industry Development Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  *
15  * Copyright (c) 2024 Huawei Device Co., Ltd.
16  * Licensed under the Apache License, Version 2.0 (the "License");
17  * you may not use this file except in compliance with the License.
18  * You may obtain a copy of the License at
19 
20  * http://www.apache.org/licenses/LICENSE-2.0
21  *
22  * Unless required by applicable law or agreed to in writing, software
23  * distributed under the License is distributed on an "AS IS" BASIS,
24  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
25  * See the License for the specific language governing permissions and
26  * limitations under the License.
27  */
28 
29 #include <gtest/gtest.h>
30 
31 #include "assembler/assembly-emitter.h"
32 #include "bytecode_optimizer/constant_propagation/constant_propagation.h"
33 #include "compiler/optimizer/ir/basicblock.h"
34 #include "compiler/optimizer/ir/graph.h"
35 #include "compiler/tests/graph_test.h"
36 #include "mem/pool_manager.h"
37 #include "optimizer/analysis/dominators_tree.h"
38 #include "optimizer/optimizations/cleanup.h"
39 
40 using namespace testing::ext;
41 
42 namespace panda::bytecodeopt {
43 
44 enum class ExpectType {
45     EXPECT_LDTRUE,
46     EXPECT_LDFALSE,
47     EXPECT_BOTH_TRUE_FALSE,
48     EXPECT_CONST,
49     EXPECT_PHI,
50     EXPECT_OTHER,
51 };
52 
53 static void VisitBlock(compiler::BasicBlock *bb, ExpectType type);
54 
55 class ConstantProgagationTest : public testing::Test {
56 public:
SetUpTestCase(void)57     static void SetUpTestCase(void) {}
TearDownTestCase(void)58     static void TearDownTestCase(void) {}
SetUp()59     void SetUp() {}
TearDown()60     void TearDown() {}
61 
62     compiler::GraphTest graph_test_;
63 
CheckFunction(const std::string &file, const char *test_method_name, ExpectType before, ExpectType after, std::unordered_map<uint32_t, std::string> *strings = nullptr)64     bool CheckFunction(const std::string &file, const char *test_method_name, ExpectType before, ExpectType after,
65                        std::unordered_map<uint32_t, std::string> *strings = nullptr)
66     {
67         bool status = false;
68 
69         graph_test_.TestBuildGraphFromFile(file, [test_method_name, before, after, strings, &status]
70             (compiler::Graph *graph, std::string &method_name) {
71             if (test_method_name != method_name) {
72                 return;
73             }
74             status = true;
75             EXPECT_NE(graph, nullptr);
76             EXPECT_TRUE(graph->RunPass<compiler::Cleanup>());
77             EXPECT_TRUE(graph->RunPass<compiler::DominatorsTree>());
78             auto &bbs = graph->GetVectorBlocks();
79             for (auto bb : bbs) {
80                 VisitBlock(bb, before);
81             }
82 
83             pandasm::AsmEmitter::PandaFileToPandaAsmMaps maps;
84             pandasm::Program *prog = nullptr;
85             if (strings != nullptr) {
86                 maps.strings = *strings;
87             }
88             BytecodeOptIrInterface interface(&maps, prog);
89             EXPECT_TRUE(graph->RunPass<ConstantPropagation>(&interface));
90             auto modified = graph->RunPass<compiler::Cleanup>();
91             if (before != after) {
92                 EXPECT_TRUE(modified);
93             }
94             for (auto bb : bbs) {
95                 VisitBlock(bb, after);
96             }
97         });
98         return status;
99     }
100 };
101 
VisitBlock(BasicBlock *bb, ExpectType type)102 static void VisitBlock(BasicBlock *bb, ExpectType type)
103 {
104     if (!bb) {
105         return;
106     }
107     for (auto inst : bb->Insts()) {
108         if (!inst->IsIntrinsic() ||
109             inst->CastToIntrinsic()->GetIntrinsicId() != RuntimeInterface::IntrinsicId::CALLARG1_IMM8_V8) {
110             continue;
111         }
112         auto input = inst->GetInput(0).GetInst();
113 
114         switch (type) {
115             case ExpectType::EXPECT_CONST:
116                 ASSERT_TRUE(input->IsConst());
117                 break;
118             case ExpectType::EXPECT_PHI:
119                 ASSERT_TRUE(input->IsPhi());
120                 break;
121             case ExpectType::EXPECT_LDTRUE: {
122                 ASSERT_TRUE(input->IsIntrinsic());
123                 auto id = input->CastToIntrinsic()->GetIntrinsicId();
124                 EXPECT_TRUE(id == RuntimeInterface::IntrinsicId::LDTRUE);
125                 break;
126             }
127             case ExpectType::EXPECT_LDFALSE: {
128                 ASSERT_TRUE(input->IsIntrinsic());
129                 auto id = input->CastToIntrinsic()->GetIntrinsicId();
130                 EXPECT_TRUE(id == RuntimeInterface::IntrinsicId::LDFALSE);
131                 break;
132             }
133             case ExpectType::EXPECT_BOTH_TRUE_FALSE: {
134                 ASSERT_TRUE(input->IsIntrinsic());
135                 auto id = input->CastToIntrinsic()->GetIntrinsicId();
136                 EXPECT_TRUE(id == RuntimeInterface::IntrinsicId::LDFALSE ||
137                             id == RuntimeInterface::IntrinsicId::LDTRUE);
138                 break;
139             }
140             case ExpectType::EXPECT_OTHER: {
141                 ASSERT_TRUE(input->IsIntrinsic());
142                 auto id = input->CastToIntrinsic()->GetIntrinsicId();
143                 EXPECT_TRUE(id != RuntimeInterface::IntrinsicId::LDFALSE &&
144                             id != RuntimeInterface::IntrinsicId::LDTRUE);
145                 break;
146             }
147         }
148     }
149 }
150 
VisitBlockCheckIf(BasicBlock *bb, bool optimize = false)151 static void VisitBlockCheckIf(BasicBlock *bb, bool optimize = false)
152 {
153     if (!bb) {
154         return;
155     }
156     for (auto inst : bb->Insts()) {
157         if (inst->GetOpcode() != Opcode::IfImm) {
158             continue;
159         }
160         auto input = inst->GetInput(0).GetInst();
161         if (!optimize) {
162             EXPECT_TRUE(input->GetOpcode() == Opcode::Compare);
163         } else {
164             auto id = input->CastToIntrinsic()->GetIntrinsicId();
165             EXPECT_TRUE(id == RuntimeInterface::IntrinsicId::LDFALSE || id == RuntimeInterface::IntrinsicId::LDTRUE);
166         }
167     }
168 }
169 
170 /**
171  * @tc.name: constant_progagation_test_001
172  * @tc.desc: Verify the pass to fold greater.
173  * @tc.type: FUNC
174  * @tc.require:
175  */
HWTEST_F(ConstantProgagationTest, constant_progagation_test_001, TestSize.Level1)176 HWTEST_F(ConstantProgagationTest, constant_progagation_test_001, TestSize.Level1)
177 {
178     std::string file = GRAPH_TEST_ABC_DIR "constantProgagation.abc";
179     const char *test_method_name = "sccpFoldGreater";
180 
181     EXPECT_TRUE(CheckFunction(file, test_method_name,
182                               ExpectType::EXPECT_OTHER, ExpectType::EXPECT_BOTH_TRUE_FALSE));
183 }
184 
185 /**
186  * @tc.name: constant_progagation_test_002
187  * @tc.desc: Verify the pass to fold greater but has no effect.
188  * @tc.type: FUNC
189  * @tc.require:
190  */
HWTEST_F(ConstantProgagationTest, constant_progagation_test_002, TestSize.Level1)191 HWTEST_F(ConstantProgagationTest, constant_progagation_test_002, TestSize.Level1)
192 {
193     std::string file = GRAPH_TEST_ABC_DIR "constantProgagation.abc";
194     const char *test_method_name = "sccpFoldGreaterNoEffect";
195 
196     EXPECT_TRUE(CheckFunction(file, test_method_name,
197                               ExpectType::EXPECT_OTHER, ExpectType::EXPECT_OTHER));
198 }
199 
200 /**
201  * @tc.name: constant_progagation_test_003
202  * @tc.desc: Verify the pass to fold greatereq.
203  * @tc.type: FUNC
204  * @tc.require:
205  */
HWTEST_F(ConstantProgagationTest, constant_progagation_test_003, TestSize.Level1)206 HWTEST_F(ConstantProgagationTest, constant_progagation_test_003, TestSize.Level1)
207 {
208     std::string file = GRAPH_TEST_ABC_DIR "constantProgagation.abc";
209     const char *test_method_name = "sccpFoldGreaterEq";
210 
211     EXPECT_TRUE(CheckFunction(file, test_method_name,
212                               ExpectType::EXPECT_OTHER, ExpectType::EXPECT_BOTH_TRUE_FALSE));
213 }
214 
215 /**
216  * @tc.name: constant_progagation_test_004
217  * @tc.desc: Verify the pass to fold greatereq but has no effect.
218  * @tc.type: FUNC
219  * @tc.require:
220  */
HWTEST_F(ConstantProgagationTest, constant_progagation_test_004, TestSize.Level1)221 HWTEST_F(ConstantProgagationTest, constant_progagation_test_004, TestSize.Level1)
222 {
223     std::string file = GRAPH_TEST_ABC_DIR "constantProgagation.abc";
224     const char *test_method_name = "sccpFoldGreaterEqNoEffect";
225 
226     EXPECT_TRUE(CheckFunction(file, test_method_name,
227                               ExpectType::EXPECT_OTHER, ExpectType::EXPECT_OTHER));
228 }
229 
230 /**
231  * @tc.name: constant_progagation_test_005
232  * @tc.desc: Verify the pass to fold less.
233  * @tc.type: FUNC
234  * @tc.require:
235  */
HWTEST_F(ConstantProgagationTest, constant_progagation_test_005, TestSize.Level1)236 HWTEST_F(ConstantProgagationTest, constant_progagation_test_005, TestSize.Level1)
237 {
238     std::string file = GRAPH_TEST_ABC_DIR "constantProgagation.abc";
239     const char *test_method_name = "sccpFoldLess";
240 
241     EXPECT_TRUE(CheckFunction(file, test_method_name,
242                               ExpectType::EXPECT_OTHER, ExpectType::EXPECT_BOTH_TRUE_FALSE));
243 }
244 
245 /**
246  * @tc.name: constant_progagation_test_006
247  * @tc.desc: Verify the pass to fold less but has no effect.
248  * @tc.type: FUNC
249  * @tc.require:
250  */
HWTEST_F(ConstantProgagationTest, constant_progagation_test_006, TestSize.Level1)251 HWTEST_F(ConstantProgagationTest, constant_progagation_test_006, TestSize.Level1)
252 {
253     std::string file = GRAPH_TEST_ABC_DIR "constantProgagation.abc";
254     const char *test_method_name = "sccpFoldLessNoEffect";
255 
256     EXPECT_TRUE(CheckFunction(file, test_method_name,
257                               ExpectType::EXPECT_OTHER, ExpectType::EXPECT_OTHER));
258 }
259 
260 /**
261  * @tc.name: constant_progagation_test_007
262  * @tc.desc: Verify the pass to fold lesseq.
263  * @tc.type: FUNC
264  * @tc.require:
265  */
HWTEST_F(ConstantProgagationTest, constant_progagation_test_007, TestSize.Level1)266 HWTEST_F(ConstantProgagationTest, constant_progagation_test_007, TestSize.Level1)
267 {
268     std::string file = GRAPH_TEST_ABC_DIR "constantProgagation.abc";
269     const char *test_method_name = "sccpFoldLessEq";
270 
271     EXPECT_TRUE(CheckFunction(file, test_method_name,
272                               ExpectType::EXPECT_OTHER, ExpectType::EXPECT_BOTH_TRUE_FALSE));
273 }
274 
275 /**
276  * @tc.name: constant_progagation_test_008
277  * @tc.desc: Verify the pass to fold lesseq but has no effect.
278  * @tc.type: FUNC
279  * @tc.require:
280  */
HWTEST_F(ConstantProgagationTest, constant_progagation_test_008, TestSize.Level1)281 HWTEST_F(ConstantProgagationTest, constant_progagation_test_008, TestSize.Level1)
282 {
283     std::string file = GRAPH_TEST_ABC_DIR "constantProgagation.abc";
284     const char *test_method_name = "sccpFoldLessEqNoEffect";
285 
286     EXPECT_TRUE(CheckFunction(file, test_method_name,
287                               ExpectType::EXPECT_OTHER, ExpectType::EXPECT_OTHER));
288 }
289 
290 /**
291  * @tc.name: constant_progagation_test_009
292  * @tc.desc: Verify the pass to fold eq.
293  * @tc.type: FUNC
294  * @tc.require:
295  */
HWTEST_F(ConstantProgagationTest, constant_progagation_test_009, TestSize.Level1)296 HWTEST_F(ConstantProgagationTest, constant_progagation_test_009, TestSize.Level1)
297 {
298     std::string file = GRAPH_TEST_ABC_DIR "constantProgagation.abc";
299     const char *test_method_name = "sccpFoldEq";
300 
301     EXPECT_TRUE(CheckFunction(file, test_method_name,
302                               ExpectType::EXPECT_OTHER, ExpectType::EXPECT_BOTH_TRUE_FALSE));
303 }
304 
305 /**
306  * @tc.name: constant_progagation_test_010
307  * @tc.desc: Verify the pass to fold eq but has no effect.
308  * @tc.type: FUNC
309  * @tc.require:
310  */
HWTEST_F(ConstantProgagationTest, constant_progagation_test_010, TestSize.Level1)311 HWTEST_F(ConstantProgagationTest, constant_progagation_test_010, TestSize.Level1)
312 {
313     std::string file = GRAPH_TEST_ABC_DIR "constantProgagation.abc";
314     const char *test_method_name = "sccpFoldEqNoEffect";
315     EXPECT_TRUE(CheckFunction(file, test_method_name,
316                               ExpectType::EXPECT_OTHER, ExpectType::EXPECT_OTHER));
317 }
318 
319 /**
320  * @tc.name: constant_progagation_test_011
321  * @tc.desc: Verify the pass to fold stricteq.
322  * @tc.type: FUNC
323  * @tc.require:
324  */
HWTEST_F(ConstantProgagationTest, constant_progagation_test_011, TestSize.Level1)325 HWTEST_F(ConstantProgagationTest, constant_progagation_test_011, TestSize.Level1)
326 {
327     std::string file = GRAPH_TEST_ABC_DIR "constantProgagation.abc";
328     const char *test_method_name = "sccpFoldStrictEq";
329 
330     EXPECT_TRUE(CheckFunction(file, test_method_name,
331                               ExpectType::EXPECT_OTHER, ExpectType::EXPECT_BOTH_TRUE_FALSE));
332 }
333 
334 /**
335  * @tc.name: constant_progagation_test_012
336  * @tc.desc: Verify the pass to fold eq but has no effect.
337  * @tc.type: FUNC
338  * @tc.require:
339  */
HWTEST_F(ConstantProgagationTest, constant_progagation_test_012, TestSize.Level1)340 HWTEST_F(ConstantProgagationTest, constant_progagation_test_012, TestSize.Level1)
341 {
342     std::string file = GRAPH_TEST_ABC_DIR "constantProgagation.abc";
343     const char *test_method_name = "sccpFoldStrictEqNoEffect";
344 
345     EXPECT_TRUE(CheckFunction(file, test_method_name,
346                               ExpectType::EXPECT_OTHER, ExpectType::EXPECT_OTHER));
347 }
348 
349 /**
350  * @tc.name: constant_progagation_test_013
351  * @tc.desc: Verify the pass to fold noteq.
352  * @tc.type: FUNC
353  * @tc.require:
354  */
HWTEST_F(ConstantProgagationTest, constant_progagation_test_013, TestSize.Level1)355 HWTEST_F(ConstantProgagationTest, constant_progagation_test_013, TestSize.Level1)
356 {
357     std::string file = GRAPH_TEST_ABC_DIR "constantProgagation.abc";
358     const char *test_method_name = "sccpFoldStrictEq";
359 
360     EXPECT_TRUE(CheckFunction(file, test_method_name,
361                               ExpectType::EXPECT_OTHER, ExpectType::EXPECT_BOTH_TRUE_FALSE));
362 }
363 
364 /**
365  * @tc.name: constant_progagation_test_014
366  * @tc.desc: Verify the pass to fold noteq but has no effect.
367  * @tc.type: FUNC
368  * @tc.require:
369  */
HWTEST_F(ConstantProgagationTest, constant_progagation_test_014, TestSize.Level1)370 HWTEST_F(ConstantProgagationTest, constant_progagation_test_014, TestSize.Level1)
371 {
372     std::string file = GRAPH_TEST_ABC_DIR "constantProgagation.abc";
373     const char *test_method_name = "sccpFoldStrictEqNoEffect";
374 
375     EXPECT_TRUE(CheckFunction(file, test_method_name,
376                               ExpectType::EXPECT_OTHER, ExpectType::EXPECT_OTHER));
377 }
378 
379 /**
380  * @tc.name: constant_progagation_test_015
381  * @tc.desc: Verify the pass to fold strictnoteq.
382  * @tc.type: FUNC
383  * @tc.require:
384  */
HWTEST_F(ConstantProgagationTest, constant_progagation_test_015, TestSize.Level1)385 HWTEST_F(ConstantProgagationTest, constant_progagation_test_015, TestSize.Level1)
386 {
387     std::string file = GRAPH_TEST_ABC_DIR "constantProgagation.abc";
388     const char *test_method_name = "sccpFoldStrictNotEq";
389 
390     EXPECT_TRUE(CheckFunction(file, test_method_name,
391                               ExpectType::EXPECT_OTHER, ExpectType::EXPECT_BOTH_TRUE_FALSE));
392 }
393 
394 /**
395  * @tc.name: constant_progagation_test_016
396  * @tc.desc: Verify the pass to fold strictnoteq but has no effect.
397  * @tc.type: FUNC
398  * @tc.require:
399  */
HWTEST_F(ConstantProgagationTest, constant_progagation_test_016, TestSize.Level1)400 HWTEST_F(ConstantProgagationTest, constant_progagation_test_016, TestSize.Level1)
401 {
402     std::string file = GRAPH_TEST_ABC_DIR "constantProgagation.abc";
403     const char *test_method_name = "sccpFoldStrictNotEqNoEffect";
404 
405     EXPECT_TRUE(CheckFunction(file, test_method_name,
406                               ExpectType::EXPECT_OTHER, ExpectType::EXPECT_OTHER));
407 }
408 
409 /**
410  * @tc.name: constant_progagation_test_017
411  * @tc.desc: Verify the pass without any effect with nan.
412  * @tc.type: FUNC
413  * @tc.require:
414  */
HWTEST_F(ConstantProgagationTest, constant_progagation_test_017, TestSize.Level1)415 HWTEST_F(ConstantProgagationTest, constant_progagation_test_017, TestSize.Level1)
416 {
417     std::string file = GRAPH_TEST_ABC_DIR "constantProgagation.abc";
418 
419     EXPECT_TRUE(CheckFunction(file, "sccpNoEffectNanWithInt",
420                               ExpectType::EXPECT_OTHER, ExpectType::EXPECT_OTHER));
421     EXPECT_TRUE(CheckFunction(file, "sccpNoEffectNanWithBoolAndDouble",
422                               ExpectType::EXPECT_OTHER, ExpectType::EXPECT_OTHER));
423 }
424 
425 /**
426  * @tc.name: constant_progagation_test_018
427  * @tc.desc: Verify the optimizion to Compare.
428  * @tc.type: FUNC
429  * @tc.require:
430  */
HWTEST_F(ConstantProgagationTest, constant_progagation_test_018, TestSize.Level1)431 HWTEST_F(ConstantProgagationTest, constant_progagation_test_018, TestSize.Level1)
432 {
433     std::string file = GRAPH_TEST_ABC_DIR "constantProgagation.abc";
434     const char *test_method_name = "sccpIfCheck";
435     bool status = false;
436 
437     graph_test_.TestBuildGraphFromFile(file, [test_method_name, &status](compiler::Graph *graph,
438                                                                          std::string &method_name) {
439         if (test_method_name != method_name) {
440             return;
441         }
442         status = true;
443         EXPECT_NE(graph, nullptr);
444         EXPECT_TRUE(graph->RunPass<compiler::Cleanup>());
445         EXPECT_TRUE(graph->RunPass<compiler::DominatorsTree>());
446         auto &bbs = graph->GetVectorBlocks();
447         for (auto bb : bbs) {
448             VisitBlockCheckIf(bb, false);
449         }
450         pandasm::AsmEmitter::PandaFileToPandaAsmMaps maps;
451         pandasm::Program *prog = nullptr;
452         BytecodeOptIrInterface interface(&maps, prog);
453         EXPECT_TRUE(graph->RunPass<ConstantPropagation>(&interface));
454         EXPECT_TRUE(graph->RunPass<compiler::Cleanup>());
455         for (auto bb : bbs) {
456             VisitBlockCheckIf(bb, true);
457         }
458     });
459     EXPECT_TRUE(status);
460 }
461 
462 /**
463  * @tc.name: constant_progagation_test_019
464  * @tc.desc: Verify the optimizion to Phi.
465  * @tc.type: FUNC
466  * @tc.require:
467  */
HWTEST_F(ConstantProgagationTest, constant_progagation_test_019, TestSize.Level1)468 HWTEST_F(ConstantProgagationTest, constant_progagation_test_019, TestSize.Level1)
469 {
470     std::string file = GRAPH_TEST_ABC_DIR "constantProgagation.abc";
471     const char *test_method_name = "sccpPhi";
472 
473     EXPECT_TRUE(CheckFunction(file, test_method_name,
474                               ExpectType::EXPECT_PHI, ExpectType::EXPECT_BOTH_TRUE_FALSE));
475 }
476 
477 /**
478  * @tc.name: constant_progagation_test_020
479  * @tc.desc: Verify the optimizion to Phi.
480  * @tc.type: FUNC
481  * @tc.require:
482  */
HWTEST_F(ConstantProgagationTest, constant_progagation_test_020, TestSize.Level1)483 HWTEST_F(ConstantProgagationTest, constant_progagation_test_020, TestSize.Level1)
484 {
485     std::string file = GRAPH_TEST_ABC_DIR "constantProgagation.abc";
486     const char *test_method_name = "sccpPhiNoEffect";
487 
488     EXPECT_TRUE(CheckFunction(file, test_method_name,
489                               ExpectType::EXPECT_PHI, ExpectType::EXPECT_PHI));
490 }
491 
492 /**
493  * @tc.name: constant_progagation_test_021
494  * @tc.desc: Verify the optimizion to Phi.
495  * @tc.type: FUNC
496  * @tc.require:
497  */
HWTEST_F(ConstantProgagationTest, constant_progagation_test_021, TestSize.Level1)498 HWTEST_F(ConstantProgagationTest, constant_progagation_test_021, TestSize.Level1)
499 {
500     std::string file = GRAPH_TEST_ABC_DIR "constantProgagation.abc";
501     const char *test_method_name = "sccpPhi2";
502 
503     EXPECT_TRUE(CheckFunction(file, test_method_name,
504                               ExpectType::EXPECT_PHI, ExpectType::EXPECT_CONST));
505 }
506 
507 /**
508  * @tc.name: constant_progagation_test_022
509  * @tc.desc: Verify the pass without any effect with inf.
510  * @tc.type: FUNC
511  * @tc.require:
512  */
HWTEST_F(ConstantProgagationTest, constant_progagation_test_022, TestSize.Level1)513 HWTEST_F(ConstantProgagationTest, constant_progagation_test_022, TestSize.Level1)
514 {
515     std::string file = GRAPH_TEST_ABC_DIR "constantProgagation.abc";
516 
517     EXPECT_TRUE(CheckFunction(file, "sccpNoEffectInfinityWithInt",
518                               ExpectType::EXPECT_OTHER, ExpectType::EXPECT_OTHER));
519     EXPECT_TRUE(CheckFunction(file, "sccpNoEffectInfinityWithBoolAndDouble",
520                               ExpectType::EXPECT_OTHER, ExpectType::EXPECT_OTHER));
521 }
522 
523 /**
524  * @tc.name: constant_progagation_test_023
525  * @tc.desc: Verify the pass without any effect with math calculation.
526  * @tc.type: FUNC
527  * @tc.require:
528  */
HWTEST_F(ConstantProgagationTest, constant_progagation_test_023, TestSize.Level1)529 HWTEST_F(ConstantProgagationTest, constant_progagation_test_023, TestSize.Level1)
530 {
531     std::string file = GRAPH_TEST_ABC_DIR "constantProgagation.abc";
532     const char *test_method_name = "sccpNoEffectArithmetic";
533 
534     EXPECT_TRUE(CheckFunction(file, test_method_name,
535                               ExpectType::EXPECT_OTHER, ExpectType::EXPECT_OTHER));
536 }
537 }  // namespace panda::bytecodeopt
538