LSE improvement: better singleton array optimization
Rationale:
In a recent LSA/LSE refactoring, we removed the "exceptional"
situation on mismatched arrays from the load-elimination branch
for merged values. As a direct result, we can relax the condition
on removing stores for singleton arrays into return blocks a bit,
as done in this CL (and shown with some tests).
Test: test-art-host,target
Bug: b/77906240
Change-Id: I32c89057168730f82d1d7c41155a9ff71b126204
diff --git a/compiler/optimizing/nodes.cc b/compiler/optimizing/nodes.cc
index 5f2833e..7f78dc2 100644
--- a/compiler/optimizing/nodes.cc
+++ b/compiler/optimizing/nodes.cc
@@ -1951,6 +1951,11 @@
return !GetInstructions().IsEmpty() && GetLastInstruction()->IsControlFlow();
}
+bool HBasicBlock::EndsWithReturn() const {
+ return !GetInstructions().IsEmpty() &&
+ (GetLastInstruction()->IsReturn() || GetLastInstruction()->IsReturnVoid());
+}
+
bool HBasicBlock::EndsWithIf() const {
return !GetInstructions().IsEmpty() && GetLastInstruction()->IsIf();
}