OSDN Git Service

X86 Long Min/Max: Avoid calling SRegToVReg with -1
authorMark Mendell <mark.p.mendell@intel.com>
Tue, 21 Oct 2014 21:44:32 +0000 (17:44 -0400)
committerMark Mendell <mark.p.mendell@intel.com>
Wed, 22 Oct 2014 13:20:32 +0000 (09:20 -0400)
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 <mark.p.mendell@intel.com>
compiler/dex/quick/x86/int_x86.cc

index 07034cb..acf5599 100755 (executable)
@@ -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