From a65c1dbb8d3511da6c0804f8063c453f744629c2 Mon Sep 17 00:00:00 2001 From: Mark Mendell Date: Tue, 21 Oct 2014 17:44:32 -0400 Subject: [PATCH] X86 Long Min/Max: Avoid calling SRegToVReg with -1 It is possible that the result of a call to min/max can't be combined with the following move. In that case, the destination will use the default long return value (EAX/EDX), with a s_reg_low value of -1. A debug compiler will assert fail in that case. Fix: A result with no s_reg_low must be unused. Just return with no code generated, like X86 GenInlinedAbsFloat(). Seen compiling GmsCore.apk on the host with a debug backend. Change-Id: I8006e822e8dcb2112d86e4047bb2e3037ba6fece Signed-off-by: Mark Mendell --- compiler/dex/quick/x86/int_x86.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/compiler/dex/quick/x86/int_x86.cc b/compiler/dex/quick/x86/int_x86.cc index 07034cb8d..acf5599d5 100755 --- a/compiler/dex/quick/x86/int_x86.cc +++ b/compiler/dex/quick/x86/int_x86.cc @@ -858,6 +858,11 @@ bool X86Mir2Lir::GenInlinedMinMax(CallInfo* info, bool is_min, bool is_long) { RegLocation rl_dest = InlineTargetWide(info); int res_vreg, src1_vreg, src2_vreg; + if (rl_dest.s_reg_low == INVALID_SREG) { + // Result is unused, the code is dead. Inlining successful, no code generated. + return true; + } + /* * If the result register is the same as the second element, then we * need to be careful. The reason is that the first copy will -- 2.11.0