summaryrefslogtreecommitdiff
path: root/compiler/optimizing/instruction_simplifier.cc
diff options
context:
space:
mode:
author Calin Juravle <calin@google.com> 2015-07-28 11:52:02 +0000
committer Calin Juravle <calin@google.com> 2015-07-28 11:52:02 +0000
commitb734808d0c93af98ec4e3539fdb0a8c0787263b0 (patch)
treea9a0a67143d5af9c375dbb9db9d874b61586f7e1 /compiler/optimizing/instruction_simplifier.cc
parent80caa1478cf3df4eac1214d8a63a4da6f4fe622b (diff)
Revert "Revert "Revert "Use the object class as top in reference type propagation"""
This reverts commit 80caa1478cf3df4eac1214d8a63a4da6f4fe622b. Change-Id: I63b51ca418b19b2bfb5ede3f8444f8fbeb8a339d
Diffstat (limited to 'compiler/optimizing/instruction_simplifier.cc')
-rw-r--r--compiler/optimizing/instruction_simplifier.cc12
1 files changed, 6 insertions, 6 deletions
diff --git a/compiler/optimizing/instruction_simplifier.cc b/compiler/optimizing/instruction_simplifier.cc
index 1089812beb..b30b6c7bae 100644
--- a/compiler/optimizing/instruction_simplifier.cc
+++ b/compiler/optimizing/instruction_simplifier.cc
@@ -195,16 +195,16 @@ bool InstructionSimplifierVisitor::IsDominatedByInputNullCheck(HInstruction* ins
// Returns whether doing a type test between the class of `object` against `klass` has
// a statically known outcome. The result of the test is stored in `outcome`.
static bool TypeCheckHasKnownOutcome(HLoadClass* klass, HInstruction* object, bool* outcome) {
- ReferenceTypeInfo obj_rti = object->GetReferenceTypeInfo();
- ScopedObjectAccess soa(Thread::Current());
- if (!obj_rti.IsValid()) {
- // We run the simplifier before the reference type propagation so type info might not be
- // available.
+ if (!klass->IsResolved()) {
+ // If the class couldn't be resolve it's not safe to compare against it. It's
+ // default type would be Top which might be wider that the actual class type
+ // and thus producing wrong results.
return false;
}
+ ReferenceTypeInfo obj_rti = object->GetReferenceTypeInfo();
ReferenceTypeInfo class_rti = klass->GetLoadedClassRTI();
- DCHECK(class_rti.IsValid() && class_rti.IsExact());
+ ScopedObjectAccess soa(Thread::Current());
if (class_rti.IsSupertypeOf(obj_rti)) {
*outcome = true;
return true;