From 50a9ed014e3b4dec67246ea07727d7bec89bfb17 Mon Sep 17 00:00:00 2001 From: Nicolas Geoffray Date: Fri, 23 Sep 2016 15:40:41 +0100 Subject: Compensate in compiler for verifier shortcomings. The verifier does not differentiate zero and null, so a move-object of zero can be used as a non-object later on. Change the compiler to ignore the object conversion when the input is zero or a phi (which might just hold zeros). The type propagation will then do proper inferencing of the types. Also remove some stalled comments in ssa_builder.cc. bug:31313170 test: dex2oat b31313170.apk test: run-test 800 test: m test-art-host-run-test Change-Id: I579d667415a7decf8ff2c2238dae4c13eec5d0e0 --- compiler/optimizing/ssa_builder.cc | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'compiler/optimizing/ssa_builder.cc') diff --git a/compiler/optimizing/ssa_builder.cc b/compiler/optimizing/ssa_builder.cc index f7dc112d00..03807ba1ee 100644 --- a/compiler/optimizing/ssa_builder.cc +++ b/compiler/optimizing/ssa_builder.cc @@ -163,18 +163,12 @@ static bool TypePhiFromInputs(HPhi* phi) { // Replace inputs of `phi` to match its type. Return false if conflict is identified. bool SsaBuilder::TypeInputsOfPhi(HPhi* phi, ArenaVector* worklist) { Primitive::Type common_type = phi->GetType(); - if (common_type == Primitive::kPrimVoid || Primitive::IsIntegralType(common_type)) { - // Phi either contains only other untyped phis (common_type == kPrimVoid), - // or `common_type` is integral and we do not need to retype ambiguous inputs - // because they are always constructed with the integral type candidate. + if (Primitive::IsIntegralType(common_type)) { + // We do not need to retype ambiguous inputs because they are always constructed + // with the integral type candidate. if (kIsDebugBuild) { for (HInstruction* input : phi->GetInputs()) { - if (common_type == Primitive::kPrimVoid) { - DCHECK(input->IsPhi() && input->GetType() == Primitive::kPrimVoid); - } else { - DCHECK((input->IsPhi() && input->GetType() == Primitive::kPrimVoid) || - HPhi::ToPhiType(input->GetType()) == common_type); - } + DCHECK(HPhi::ToPhiType(input->GetType()) == common_type); } } // Inputs did not need to be replaced, hence no conflict. Report success. -- cgit v1.2.3-59-g8ed1b