summaryrefslogtreecommitdiff
path: root/src/compiler/codegen/LocalOptimizations.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/compiler/codegen/LocalOptimizations.cc')
-rw-r--r--src/compiler/codegen/LocalOptimizations.cc8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/compiler/codegen/LocalOptimizations.cc b/src/compiler/codegen/LocalOptimizations.cc
index 55ba03aea8..faab3e0046 100644
--- a/src/compiler/codegen/LocalOptimizations.cc
+++ b/src/compiler/codegen/LocalOptimizations.cc
@@ -86,11 +86,16 @@ void applyLoadStoreElimination(CompilationUnit* cUnit, LIR* headLIR,
/* Skip non-interesting instructions */
if ((thisLIR->flags.isNop == true) ||
isPseudoOpcode(thisLIR->opcode) ||
+ (EncodingMap[thisLIR->opcode].flags & IS_BRANCH) ||
!(EncodingMap[thisLIR->opcode].flags & (IS_LOAD | IS_STORE))) {
continue;
}
+#if defined(TARGET_X86)
+ int nativeRegId = (EncodingMap[thisLIR->opcode].flags & IS_STORE) ? thisLIR->operands[2] : thisLIR->operands[0];
+#else
int nativeRegId = thisLIR->operands[0];
+#endif
bool isThisLIRLoad = EncodingMap[thisLIR->opcode].flags & IS_LOAD;
LIR* checkLIR;
/* Use the mem mask to determine the rough memory location */
@@ -102,9 +107,8 @@ void applyLoadStoreElimination(CompilationUnit* cUnit, LIR* headLIR,
*/
if (!(thisMemMask & (ENCODE_LITERAL | ENCODE_DALVIK_REG))) continue;
-// FIXME: make sure we have a branch barrier for x86
#if defined(TARGET_X86)
- u8 stopUseRegMask = (thisLIR->useMask) & ~ENCODE_MEM;
+ u8 stopUseRegMask = (IS_BRANCH | thisLIR->useMask) & ~ENCODE_MEM;
#else
/*
* Add r15 (pc) to the resource mask to prevent this instruction