Code sinking can move around LoadString that can throw.
The test accidentally used a string part of the boot image, which means
we know the instruction won't throw. However, a change in the boot
classpath meant the string "a" was not part of the boot image anymore,
and the test started failing.
The CL now handles the case the LoadString might throw, and treat it
like NewInstance/NewArray.
Test: 672-checker-throw-method, 673-checker-throw-vmethod
Bug: 156559242
Change-Id: If9df2ed2c7c39c56254970172e315ec5113db64e
diff --git a/compiler/optimizing/code_sinking.cc b/compiler/optimizing/code_sinking.cc
index f406983..f946e50 100644
--- a/compiler/optimizing/code_sinking.cc
+++ b/compiler/optimizing/code_sinking.cc
@@ -58,8 +58,8 @@
}
}
- // Check allocations first, as they can throw, but it is safe to move them.
- if (instruction->IsNewInstance() || instruction->IsNewArray()) {
+ // Check allocations and strings first, as they can throw, but it is safe to move them.
+ if (instruction->IsNewInstance() || instruction->IsNewArray() || instruction->IsLoadString()) {
return true;
}