Add "unknown" results for memdep, which mean "I don't know whether a dependence for the given instruction exists in the given block". This cleans up all the existing hacks in memdep which represent this concept by returning clobber with various unrelated instructions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133031 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Eli Friedman
2011-06-15 00:47:34 +00:00
parent 7b9cafde5e
commit a990e071f2
6 changed files with 84 additions and 55 deletions
+19 -10
View File
@@ -79,8 +79,8 @@ bool MemDepPrinter::runOnFunction(Function &F) {
MemDepResult Res = MDA.getDependency(Inst);
if (!Res.isNonLocal()) {
assert(Res.isClobber() != Res.isDef() &&
"Local dep should be def or clobber!");
assert((Res.isUnknown() || Res.isClobber() || Res.isDef()) &&
"Local dep should be unknown, def or clobber!");
Deps[Inst].insert(std::make_pair(InstAndClobberFlag(Res.getInst(),
Res.isClobber()),
static_cast<BasicBlock *>(0)));
@@ -92,8 +92,9 @@ bool MemDepPrinter::runOnFunction(Function &F) {
for (MemoryDependenceAnalysis::NonLocalDepInfo::const_iterator
I = NLDI.begin(), E = NLDI.end(); I != E; ++I) {
const MemDepResult &Res = I->getResult();
assert(Res.isClobber() != Res.isDef() &&
"Resolved non-local call dep should be def or clobber!");
assert((Res.isUnknown() || Res.isClobber() || Res.isDef()) &&
"Resolved non-local call dep should be unknown, def or "
"clobber!");
InstDeps.insert(std::make_pair(InstAndClobberFlag(Res.getInst(),
Res.isClobber()),
I->getBB()));
@@ -148,16 +149,24 @@ void MemDepPrinter::print(raw_ostream &OS, const Module *M) const {
bool isClobber = I->first.getInt();
const BasicBlock *DepBB = I->second;
OS << " " << (isClobber ? "Clobber" : " Def");
OS << " ";
if (!DepInst)
OS << "Unknown";
else if (isClobber)
OS << "Clobber";
else
OS << " Def";
if (DepBB) {
OS << " in block ";
WriteAsOperand(OS, DepBB, /*PrintType=*/false, M);
}
OS << " from: ";
if (DepInst == Inst)
OS << "<unspecified>";
else
DepInst->print(OS);
if (DepInst) {
OS << " from: ";
if (DepInst == Inst)
OS << "<unspecified>";
else
DepInst->print(OS);
}
OS << "\n";
}