From 70c0403aff06094c6b291fc0c3abb503beaeb1f0 Mon Sep 17 00:00:00 2001 From: Vladimir Marko Date: Tue, 18 Feb 2025 08:10:23 +0000 Subject: Optimizing: Add comments to `HInstruction::Add{,Env}UseAt()`. This is a follow-up for https://android-review.googlesource.com/3497214 to add some explanatory comments. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Bug: 181943478 Change-Id: Ibe759e2851d3d6c6c92a41c33e30798f37687b9f --- compiler/optimizing/nodes.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'compiler/optimizing') diff --git a/compiler/optimizing/nodes.h b/compiler/optimizing/nodes.h index 385fd293de..e59dcf26c1 100644 --- a/compiler/optimizing/nodes.h +++ b/compiler/optimizing/nodes.h @@ -2233,6 +2233,10 @@ class HInstruction : public ArenaObject { // Note: `old_begin` remains valid across `push_front()`. auto old_begin = uses_.begin(); uses_.push_front(*new_node); + // To speed up this code, we inline the + // FixUpUserRecordsAfterUseInsertion( + // old_begin != uses_.end() ? ++old_begin : old_begin); + // to reduce branching as we know that we're going to fix up either one or two entries. auto new_begin = uses_.begin(); user->SetRawInputRecordAt(index, HUserRecord(this, uses_.before_begin())); if (old_begin != uses_.end()) { @@ -2250,6 +2254,10 @@ class HInstruction : public ArenaObject { // Note: `old_env_begin` remains valid across `push_front()`. auto old_env_begin = env_uses_.begin(); env_uses_.push_front(*new_node); + // To speed up this code, we inline the + // FixUpUserRecordsAfterEnvUseInsertion( + // old_env_begin != env_uses_.end() ? ++old_env_begin : old_env_begin); + // to reduce branching as we know that we're going to fix up either one or two entries. auto new_env_begin = env_uses_.begin(); user->GetVRegs()[index] = HUserRecord(this, env_uses_.before_begin()); if (old_env_begin != env_uses_.end()) { -- cgit v1.2.3-59-g8ed1b