From 573b42936ba7fbf296452875cdcadedc619418ef Mon Sep 17 00:00:00 2001 From: jeffhao Date: Mon, 30 Jul 2012 16:37:41 -0700 Subject: 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 --- src/compiler/codegen/LocalOptimizations.cc | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/compiler/codegen/LocalOptimizations.cc') diff --git a/src/compiler/codegen/LocalOptimizations.cc b/src/compiler/codegen/LocalOptimizations.cc index faab3e0046..2fc7ae0ccd 100644 --- a/src/compiler/codegen/LocalOptimizations.cc +++ b/src/compiler/codegen/LocalOptimizations.cc @@ -226,6 +226,15 @@ void applyLoadStoreElimination(CompilationUnit* cUnit, LIR* headLIR, } 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) { -- cgit v1.2.3-59-g8ed1b