SSA renaming fix & invalid opcode fix
The old SSA renaming mechanism was able to take some shortcuts because
of the limited CFG shapes it encountered. Shortcut replaced and previous
workaround code removed.
Also fixes a regression introduced by the stack bounds checking change
which sometimes resulted in an (opcode < 0x200) assert failure, and
removes an optimization flag and associated code that no longer applicable.
Change-Id: I617e9e5347dfd3a7e8f44a9772647bf4530631d6
diff --git a/src/compiler/codegen/Optimizer.h b/src/compiler/codegen/Optimizer.h
index c485717..b234587 100644
--- a/src/compiler/codegen/Optimizer.h
+++ b/src/compiler/codegen/Optimizer.h
@@ -26,7 +26,6 @@
enum optControlVector {
kLoadStoreElimination = 0,
kLoadHoisting,
- kTrackLiveTemps,
kSuppressLoads,
kPromoteRegs,
};
diff --git a/src/compiler/codegen/RallocUtil.cc b/src/compiler/codegen/RallocUtil.cc
index 76cff17..8295b33 100644
--- a/src/compiler/codegen/RallocUtil.cc
+++ b/src/compiler/codegen/RallocUtil.cc
@@ -1004,38 +1004,15 @@
return loc;
}
-/*
- * There's currently a problem in SSA renaming. So long as register promotion
- * is disabled, a bad renaming will have no effect. Work around the problem
- * here to make progress while the fix is being identified.
- */
-#define SSA_WORKAROUND
-
extern RegLocation oatGetDest(CompilationUnit* cUnit, MIR* mir, int num)
{
RegLocation res = cUnit->regLocation[mir->ssaRep->defs[num]];
-#ifdef SSA_WORKAROUND
- if (res.wide) {
- LOG(WARNING) << "Invalid SSA renaming: " << PrettyMethod(cUnit->method);
- cUnit->printMe = true;
- cUnit->dumpCFG = true;
- res.wide = false;
- }
-#endif
assert(!res.wide);
return res;
}
extern RegLocation oatGetSrc(CompilationUnit* cUnit, MIR* mir, int num)
{
RegLocation res = cUnit->regLocation[mir->ssaRep->uses[num]];
-#ifdef SSA_WORKAROUND
- if (res.wide) {
- LOG(WARNING) << "Invalid SSA renaming: " << PrettyMethod(cUnit->method);
- cUnit->printMe = true;
- cUnit->dumpCFG = true;
- res.wide = false;
- }
-#endif
assert(!res.wide);
return res;
}
@@ -1048,14 +1025,6 @@
int low, int high)
{
RegLocation res = cUnit->regLocation[mir->ssaRep->defs[low]];
-#ifdef SSA_WORKAROUND
- if (!res.wide) {
- LOG(WARNING) << "Invalid SSA renaming: " << PrettyMethod(cUnit->method);
- cUnit->printMe = true;
- cUnit->dumpCFG = true;
- res.wide = true;
- }
-#endif
assert(res.wide);
return res;
}
@@ -1064,14 +1033,6 @@
int low, int high)
{
RegLocation res = cUnit->regLocation[mir->ssaRep->uses[low]];
-#ifdef SSA_WORKAROUND
- if (!res.wide) {
- LOG(WARNING) << "Invalid SSA renaming: " << PrettyMethod(cUnit->method);
- cUnit->printMe = true;
- cUnit->dumpCFG = true;
- res.wide = true;
- }
-#endif
assert(res.wide);
return res;
}
diff --git a/src/compiler/codegen/arm/MethodCodegenDriver.cc b/src/compiler/codegen/arm/MethodCodegenDriver.cc
index 8070e8d..10f470d 100644
--- a/src/compiler/codegen/arm/MethodCodegenDriver.cc
+++ b/src/compiler/codegen/arm/MethodCodegenDriver.cc
@@ -1878,9 +1878,7 @@
for (mir = bb->firstMIRInsn; mir; mir = mir->next) {
oatResetRegPool(cUnit);
- if (cUnit->disableOpt & (1 << kTrackLiveTemps)) {
- oatClobberAllRegs(cUnit);
- }
+ oatClobberAllRegs(cUnit);
if (cUnit->disableOpt & (1 << kSuppressLoads)) {
oatResetDefTracking(cUnit);