Simplify handling of finalizable in LSE.
Finalizable is treated as being returned which simplifies its handling.
Test: run-test on host, 530-checker-lse contains tests on finalizable.
Change-Id: I492470e4d2ba88865029675c51cf10325af47057
diff --git a/compiler/optimizing/escape.cc b/compiler/optimizing/escape.cc
index 9df5bf1..0a92703 100644
--- a/compiler/optimizing/escape.cc
+++ b/compiler/optimizing/escape.cc
@@ -36,6 +36,12 @@
*is_singleton = true;
*is_singleton_and_not_returned = true;
*is_singleton_and_not_deopt_visible = true;
+
+ if (reference->IsNewInstance() && reference->AsNewInstance()->IsFinalizable()) {
+ // Finalizable reference is treated as being returned in the end.
+ *is_singleton_and_not_returned = false;
+ }
+
// Visit all uses to determine if this reference can escape into the heap,
// a method call, an alias, etc.
for (const HUseListNode<HInstruction*>& use : reference->GetUses()) {