mirror of
https://github.com/RPCS3/llvm.git
synced 2024-11-30 07:00:57 +00:00
Fixed a really ugly bug. The TableGen'd isel is not freeing the "inflight set"
correctly. That is causing non-deterministic behavior (and possibly preventing some load folding from happening). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28458 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
d63b964850
commit
b0793f9741
@ -2407,20 +2407,32 @@ public:
|
|||||||
std::string Fn = CP->getSelectFunc();
|
std::string Fn = CP->getSelectFunc();
|
||||||
NumRes = CP->getNumOperands();
|
NumRes = CP->getNumOperands();
|
||||||
for (unsigned i = 0; i < NumRes; ++i)
|
for (unsigned i = 0; i < NumRes; ++i)
|
||||||
emitDecl("Tmp" + utostr(i+ResNo));
|
emitDecl("CPTmp" + utostr(i+ResNo));
|
||||||
|
|
||||||
std::string Code = Fn + "(" + Val;
|
std::string Code = "bool Match = " + Fn + "(" + Val;
|
||||||
for (unsigned i = 0; i < NumRes; i++)
|
for (unsigned i = 0; i < NumRes; i++)
|
||||||
Code += ", Tmp" + utostr(i + ResNo);
|
Code += ", CPTmp" + utostr(i + ResNo);
|
||||||
emitCheck(Code + ")");
|
emitCode(Code + ");");
|
||||||
|
if (InflightNodes.size()) {
|
||||||
|
// Remove the in-flight nodes if the ComplexPattern does not match!
|
||||||
|
emitCode("if (!Match) {");
|
||||||
|
for (std::vector<std::string>::iterator AI = InflightNodes.begin(),
|
||||||
|
AE = InflightNodes.end(); AI != AE; ++AI)
|
||||||
|
emitCode(" InFlightSet.erase(" + *AI + ".Val);");
|
||||||
|
emitCode("}");
|
||||||
|
}
|
||||||
|
|
||||||
|
emitCheck("Match");
|
||||||
|
|
||||||
for (unsigned i = 0; i < NumRes; ++i) {
|
for (unsigned i = 0; i < NumRes; ++i) {
|
||||||
emitCode("InFlightSet.insert(Tmp" + utostr(i+ResNo) + ".Val);");
|
emitCode("InFlightSet.insert(CPTmp" + utostr(i+ResNo) + ".Val);");
|
||||||
InflightNodes.push_back("Tmp" + utostr(i+ResNo));
|
InflightNodes.push_back("CPTmp" + utostr(i+ResNo));
|
||||||
}
|
}
|
||||||
for (unsigned i = 0; i < NumRes; ++i)
|
for (unsigned i = 0; i < NumRes; ++i) {
|
||||||
emitCode("Select(Tmp" + utostr(i+ResNo) + ", Tmp" +
|
emitDecl("Tmp" + utostr(i+ResNo));
|
||||||
|
emitCode("Select(Tmp" + utostr(i+ResNo) + ", CPTmp" +
|
||||||
utostr(i+ResNo) + ");");
|
utostr(i+ResNo) + ");");
|
||||||
|
}
|
||||||
|
|
||||||
TmpNo = ResNo + NumRes;
|
TmpNo = ResNo + NumRes;
|
||||||
} else {
|
} else {
|
||||||
@ -2524,7 +2536,6 @@ public:
|
|||||||
|
|
||||||
// Make sure these operands which would be selected won't be folded while
|
// Make sure these operands which would be selected won't be folded while
|
||||||
// the isel traverses the DAG upward.
|
// the isel traverses the DAG upward.
|
||||||
std::vector<std::pair<unsigned, unsigned> > NumTemps(EmitOrder.size());
|
|
||||||
for (unsigned i = 0, e = EmitOrder.size(); i != e; ++i) {
|
for (unsigned i = 0, e = EmitOrder.size(); i != e; ++i) {
|
||||||
TreePatternNode *Child = EmitOrder[i].second;
|
TreePatternNode *Child = EmitOrder[i].second;
|
||||||
if (!Child->getName().empty()) {
|
if (!Child->getName().empty()) {
|
||||||
@ -2539,6 +2550,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Emit all of the operands.
|
// Emit all of the operands.
|
||||||
|
std::vector<std::pair<unsigned, unsigned> > NumTemps(EmitOrder.size());
|
||||||
for (unsigned i = 0, e = EmitOrder.size(); i != e; ++i) {
|
for (unsigned i = 0, e = EmitOrder.size(); i != e; ++i) {
|
||||||
unsigned OpOrder = EmitOrder[i].first;
|
unsigned OpOrder = EmitOrder[i].first;
|
||||||
TreePatternNode *Child = EmitOrder[i].second;
|
TreePatternNode *Child = EmitOrder[i].second;
|
||||||
|
Loading…
Reference in New Issue
Block a user