summaryrefslogtreecommitdiff
path: root/compiler/optimizing/constant_folding.cc
diff options
context:
space:
mode:
author Vladimir Marko <vmarko@google.com> 2024-02-08 09:49:48 +0000
committer VladimĂ­r Marko <vmarko@google.com> 2024-02-09 09:05:18 +0000
commitced2fc97ec95f2924059544f13d6ff353973d552 (patch)
tree7131429c7cd6b9a18ef255ce5d7a160ac274c371 /compiler/optimizing/constant_folding.cc
parentcea2f596f98b79fafaded1c36c98aa3fa04d5147 (diff)
Clean up `HGraphVisitor::VisitBasicBlock()`.
Skip `HPhi::Accept()` and add functions to visit only Phis or only non-Phi instructions. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Bug: 181943478 Change-Id: Iba0690ae70f46d6a2bafa9055b2ae5167e58a2f4
Diffstat (limited to 'compiler/optimizing/constant_folding.cc')
-rw-r--r--compiler/optimizing/constant_folding.cc9
1 files changed, 3 insertions, 6 deletions
diff --git a/compiler/optimizing/constant_folding.cc b/compiler/optimizing/constant_folding.cc
index b0a65ca64d..f57d8ade16 100644
--- a/compiler/optimizing/constant_folding.cc
+++ b/compiler/optimizing/constant_folding.cc
@@ -117,12 +117,9 @@ bool HConstantFolding::Run() {
void HConstantFoldingVisitor::VisitBasicBlock(HBasicBlock* block) {
- // Traverse this block's instructions (phis don't need to be
- // processed) in (forward) order and replace the ones that can be
- // statically evaluated by a compile-time counterpart.
- for (HInstructionIterator it(block->GetInstructions()); !it.Done(); it.Advance()) {
- it.Current()->Accept(this);
- }
+ // Traverse this block's instructions (phis don't need to be processed) in (forward) order
+ // and replace the ones that can be statically evaluated by a compile-time counterpart.
+ VisitNonPhiInstructions(block);
}
void HConstantFoldingVisitor::VisitUnaryOperation(HUnaryOperation* inst) {