Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(28)

Unified Diff: src/IceInst.cpp

Issue 2177033002: Subzero: Local variable splitting. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Code review changes. Fix a bad transformation. Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« src/IceCfg.cpp ('K') | « src/IceInst.h ('k') | src/IceInstX86Base.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/IceInst.cpp
diff --git a/src/IceInst.cpp b/src/IceInst.cpp
index 2d67f377be8278c45e9d9dd84c5656c5e5152db7..6c377797cf33cbe13c747ce9bfd0cb0d729707b1 100644
--- a/src/IceInst.cpp
+++ b/src/IceInst.cpp
@@ -1090,9 +1090,10 @@ void InstIcmp::reverseConditionAndOperands() {
Condition = InstIcmpAttributes[Condition].Reverse;
std::swap(Srcs[0], Srcs[1]);
}
+
bool checkForRedundantAssign(const Variable *Dest, const Operand *Source) {
const auto *SrcVar = llvm::dyn_cast<const Variable>(Source);
- if (!SrcVar)
+ if (SrcVar == nullptr)
return false;
if (Dest->hasReg() && Dest->getRegNum() == SrcVar->getRegNum()) {
// TODO: On x86-64, instructions like "mov eax, eax" are used to clear the
@@ -1101,6 +1102,8 @@ bool checkForRedundantAssign(const Variable *Dest, const Operand *Source) {
}
if (!Dest->hasReg() && !SrcVar->hasReg()) {
if (!Dest->hasStackOffset() || !SrcVar->hasStackOffset()) {
+ // If called before stack slots have been assigned (i.e. as part of the
+ // dump() routine), conservatively return false.
return false;
}
if (Dest->getStackOffset() != SrcVar->getStackOffset()) {
@@ -1108,6 +1111,13 @@ bool checkForRedundantAssign(const Variable *Dest, const Operand *Source) {
}
return true;
}
+ // For a "v=t" assignment where t has a register, v has a stack slot, and v
+ // has a LinkedTo stack root, return true. This is because this assignment is
+ // effectively reassigning the same value to the original LinkedTo stack root.
+ if (SrcVar->hasReg() && Dest->hasStackOffset() &&
+ Dest->getLinkedToStackRoot() != nullptr) {
+ return true;
+ }
return false;
}
« src/IceCfg.cpp ('K') | « src/IceInst.h ('k') | src/IceInstX86Base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698