summaryrefslogtreecommitdiff
path: root/compiler/optimizing/constant_folding_test.cc
diff options
context:
space:
mode:
author Vladimir Marko <vmarko@google.com> 2024-08-06 07:54:26 +0000
committer Treehugger Robot <android-test-infra-autosubmit@system.gserviceaccount.com> 2024-08-12 14:00:38 +0000
commit4018a7d772fc09c7955eb4c88eea788be5cc2143 (patch)
tree45ebb2078a2ad1c5d61cfcb76a4585ab84159ef1 /compiler/optimizing/constant_folding_test.cc
parentbed0b477e8f55d57cf100c585eb6d5838c9ffcee (diff)
ART: Clean up HIR construction in gtests.
Make `OptimizingUnitTestHelper::Make*()` functions add the the new instruction to the block. If the block already ends with a control flow instruction, the new instruction is inserted before the control flow instruction (some tests create the control flow before adding instruction). Add new helper functions for additional instruction types, rename and clean up existing helpers. Test: m test-art-host-gtest Change-Id: I0bb88bc4d2ff6ce98ddbec25990a1ae68f582042
Diffstat (limited to 'compiler/optimizing/constant_folding_test.cc')
-rw-r--r--compiler/optimizing/constant_folding_test.cc10
1 files changed, 4 insertions, 6 deletions
diff --git a/compiler/optimizing/constant_folding_test.cc b/compiler/optimizing/constant_folding_test.cc
index 689d77111c..7ff8649fa9 100644
--- a/compiler/optimizing/constant_folding_test.cc
+++ b/compiler/optimizing/constant_folding_test.cc
@@ -748,10 +748,8 @@ TEST_F(ConstantFoldingTest, UnsignedComparisonsWithZero) {
block->AddSuccessor(exit_block);
// Make various unsigned comparisons with zero against a parameter.
- HInstruction* parameter = new (GetAllocator()) HParameterValue(
- graph_->GetDexFile(), dex::TypeIndex(0), 0, DataType::Type::kInt32, true);
- entry_block->AddInstruction(parameter);
- entry_block->AddInstruction(new (GetAllocator()) HGoto());
+ HInstruction* parameter = MakeParam(DataType::Type::kInt32);
+ MakeGoto(entry_block);
HInstruction* zero = graph_->GetIntConstant(0);
@@ -772,9 +770,9 @@ TEST_F(ConstantFoldingTest, UnsignedComparisonsWithZero) {
block->AddInstruction(new (GetAllocator()) HSelect(last, parameter, parameter, 0));
block->AddInstruction(last = new (GetAllocator()) HBelowOrEqual(parameter, zero));
block->AddInstruction(new (GetAllocator()) HSelect(last, parameter, parameter, 0));
- block->AddInstruction(new (GetAllocator()) HReturn(zero));
+ MakeReturn(block, zero);
- exit_block->AddInstruction(new (GetAllocator()) HExit());
+ MakeExit(exit_block);
graph_->BuildDominatorTree();