Enable load store elimination on x86.

Includes a fix to prevent stores from being sunk between cmp and jcc
ops. Also fixes neg-float/double when the source and destination are the
same register. All optis are enabled by default on x86 now.

Change-Id: Ie6f1a3a5ba94fd1b5298df87779d70d9868e8baa
diff --git a/src/compiler/codegen/LocalOptimizations.cc b/src/compiler/codegen/LocalOptimizations.cc
index faab3e0..2fc7ae0 100644
--- a/src/compiler/codegen/LocalOptimizations.cc
+++ b/src/compiler/codegen/LocalOptimizations.cc
@@ -226,6 +226,15 @@
       }
 
       if (stopHere == true) {
+#if defined(TARGET_X86)
+        // Prevent stores from being sunk between ops that generate ccodes and
+        // ops that use them.
+        int flags = EncodingMap[checkLIR->opcode].flags;
+        if (sinkDistance > 0 && (flags & IS_BRANCH) && (flags & USES_CCODES)) {
+          checkLIR = PREV_LIR(checkLIR);
+          sinkDistance--;
+        }
+#endif
         DEBUG_OPT(dumpDependentInsnPair(thisLIR, checkLIR, "REG CLOBBERED"));
         /* Only sink store instructions */
         if (sinkDistance && !isThisLIRLoad) {