#include "llvm/Support/Compiler.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/ValueHandle.h"
+#include "llvm/Support/raw_ostream.h"
using namespace llvm;
STATISTIC(NumThreads, "Number of jumps threaded");
/// runOnFunction - Top level algorithm.
///
bool JumpThreading::runOnFunction(Function &F) {
- DOUT << "Jump threading on function '" << F.getNameStart() << "'\n";
+ DEBUG(errs() << "Jump threading on function '" << F.getName() << "'\n");
TD = getAnalysisIfAvailable<TargetData>();
FindLoopHeaders(F);
// edges which simplifies the CFG.
if (pred_begin(BB) == pred_end(BB) &&
BB != &BB->getParent()->getEntryBlock()) {
- DOUT << " JT: Deleting dead block '" << BB->getNameStart()
- << "' with terminator: " << *BB->getTerminator();
+ DEBUG(errs() << " JT: Deleting dead block '" << BB->getName()
+ << "' with terminator: " << *BB->getTerminator());
LoopHeaders.erase(BB);
DeleteDeadBlock(BB);
Changed = true;
if (CommonPreds.size() == 1)
return CommonPreds[0];
- DOUT << " Factoring out " << CommonPreds.size()
- << " common predecessors.\n";
+ DEBUG(errs() << " Factoring out " << CommonPreds.size()
+ << " common predecessors.\n");
return SplitBlockPredecessors(PN->getParent(),
&CommonPreds[0], CommonPreds.size(),
".thr_comm", this);
// terminator to an unconditional branch. This can occur due to threading in
// other blocks.
if (isa<ConstantInt>(Condition)) {
- DOUT << " In block '" << BB->getNameStart()
- << "' folding terminator: " << *BB->getTerminator();
+ DEBUG(errs() << " In block '" << BB->getName()
+ << "' folding terminator: " << *BB->getTerminator());
++NumFolds;
ConstantFoldTerminator(BB);
return true;
BBTerm->getSuccessor(i)->removePredecessor(BB);
}
- DOUT << " In block '" << BB->getNameStart()
- << "' folding undef terminator: " << *BBTerm;
+ DEBUG(errs() << " In block '" << BB->getName()
+ << "' folding undef terminator: " << *BBTerm);
BranchInst::Create(BBTerm->getSuccessor(MinSucc), BBTerm);
BBTerm->eraseFromParent();
return true;
else if (PredBI->getSuccessor(0) != BB)
BranchDir = false;
else {
- DOUT << " In block '" << PredBB->getNameStart()
- << "' folding terminator: " << *PredBB->getTerminator();
+ DEBUG(errs() << " In block '" << PredBB->getName()
+ << "' folding terminator: " << *PredBB->getTerminator());
++NumFolds;
ConstantFoldTerminator(PredBB);
return true;
// If the dest block has one predecessor, just fix the branch condition to a
// constant and fold it.
if (BB->getSinglePredecessor()) {
- DOUT << " In block '" << BB->getNameStart()
- << "' folding condition to '" << BranchDir << "': "
- << *BB->getTerminator();
+ DEBUG(errs() << " In block '" << BB->getName()
+ << "' folding condition to '" << BranchDir << "': "
+ << *BB->getTerminator());
++NumFolds;
DestBI->setCondition(ConstantInt::get(Type::Int1Ty, BranchDir));
ConstantFoldTerminator(BB);
// involves code duplication. Check to see if it is worth it.
unsigned JumpThreadCost = getJumpThreadDuplicationCost(BB);
if (JumpThreadCost > Threshold) {
- DOUT << " Not threading BB '" << BB->getNameStart()
- << "' - Cost is too high: " << JumpThreadCost << "\n";
+ DEBUG(errs() << " Not threading BB '" << BB->getName()
+ << "' - Cost is too high: " << JumpThreadCost << "\n");
return false;
}
// Otherwise, we're safe to make the change. Make sure that the edge from
// DestSI to DestSucc is not critical and has no PHI nodes.
- DOUT << "FORWARDING EDGE " << *DestVal << " FROM: " << *PredSI;
- DOUT << "THROUGH: " << *DestSI;
+ DEBUG(errs() << "FORWARDING EDGE " << *DestVal << " FROM: " << *PredSI);
+ DEBUG(errs() << "THROUGH: " << *DestSI);
// If the destination has PHI nodes, just split the edge for updating
// simplicity.
BasicBlock *BB = PN->getParent();
unsigned JumpThreadCost = getJumpThreadDuplicationCost(BB);
if (JumpThreadCost > Threshold) {
- DOUT << " Not threading BB '" << BB->getNameStart()
- << "' - Cost is too high: " << JumpThreadCost << "\n";
+ DEBUG(errs() << " Not threading BB '" << BB->getName()
+ << "' - Cost is too high: " << JumpThreadCost << "\n");
return false;
}
// See if the cost of duplicating this block is low enough.
unsigned JumpThreadCost = getJumpThreadDuplicationCost(BB);
if (JumpThreadCost > Threshold) {
- DOUT << " Not threading BB '" << BB->getNameStart()
- << "' - Cost is too high: " << JumpThreadCost << "\n";
+ DEBUG(errs() << " Not threading BB '" << BB->getName()
+ << "' - Cost is too high: " << JumpThreadCost << "\n");
return false;
}
// See if the cost of duplicating this block is low enough.
unsigned JumpThreadCost = getJumpThreadDuplicationCost(BB);
if (JumpThreadCost > Threshold) {
- DOUT << " Not threading BB '" << BB->getNameStart()
- << "' - Cost is too high: " << JumpThreadCost << "\n";
+ DEBUG(errs() << " Not threading BB '" << BB->getNameStart()
+ << "' - Cost is too high: " << JumpThreadCost << "\n");
return false;
}
// If threading to the same block as we come from, we would infinite loop.
if (SuccBB == BB) {
- DOUT << " Not threading across BB '" << BB->getNameStart()
- << "' - would thread to self!\n";
+ DEBUG(errs() << " Not threading across BB '" << BB->getName()
+ << "' - would thread to self!\n");
return false;
}
// If threading this would thread across a loop header, don't thread the edge.
// See the comments above FindLoopHeaders for justifications and caveats.
if (LoopHeaders.count(BB)) {
- DOUT << " Not threading from '" << PredBB->getNameStart()
- << "' across loop header BB '" << BB->getNameStart()
- << "' to dest BB '" << SuccBB->getNameStart()
- << "' - it might create an irreducible loop!\n";
+ DEBUG(errs() << " Not threading from '" << PredBB->getName()
+ << "' across loop header BB '" << BB->getName()
+ << "' to dest BB '" << SuccBB->getName()
+ << "' - it might create an irreducible loop!\n");
return false;
}
// And finally, do it!
- DOUT << " Threading edge from '" << PredBB->getNameStart() << "' to '"
- << SuccBB->getNameStart() << "' with cost: " << JumpThreadCost
- << ", across block:\n "
- << *BB << "\n";
+ DEBUG(errs() << " Threading edge from '" << PredBB->getName() << "' to '"
+ << SuccBB->getNameStart() << "' with cost: " << JumpThreadCost
+ << ", across block:\n "
+ << *BB << "\n");
// Jump Threading can not update SSA properties correctly if the values
// defined in the duplicated block are used outside of the block itself. For
// floor((double)floatval) -> (double)floorf(floatval)
Value *V = Cast->getOperand(0);
- V = EmitUnaryFloatFnCall(V, Callee->getNameStart(), B);
+ V = EmitUnaryFloatFnCall(V, Callee->getName().data(), B);
return B.CreateFPExt(V, Type::DoubleTy);
}
};
if (!F.isDeclaration())
continue;
- unsigned NameLen = F.getNameLen();
- if (!NameLen)
+ if (!F.hasName())
continue;
const FunctionType *FTy = F.getFunctionType();
- const char *NameStr = F.getNameStart();
- switch (NameStr[0]) {
+ StringRef Name = F.getName();
+ switch (Name[0]) {
case 's':
- if (NameLen == 6 && !strcmp(NameStr, "strlen")) {
+ if (Name == "strlen") {
if (FTy->getNumParams() != 1 ||
!isa<PointerType>(FTy->getParamType(0)))
continue;
setOnlyReadsMemory(F);
setDoesNotThrow(F);
setDoesNotCapture(F, 1);
- } else if ((NameLen == 6 && !strcmp(NameStr, "strcpy")) ||
- (NameLen == 6 && !strcmp(NameStr, "stpcpy")) ||
- (NameLen == 6 && !strcmp(NameStr, "strcat")) ||
- (NameLen == 6 && !strcmp(NameStr, "strtol")) ||
- (NameLen == 6 && !strcmp(NameStr, "strtod")) ||
- (NameLen == 6 && !strcmp(NameStr, "strtof")) ||
- (NameLen == 7 && !strcmp(NameStr, "strtoul")) ||
- (NameLen == 7 && !strcmp(NameStr, "strtoll")) ||
- (NameLen == 7 && !strcmp(NameStr, "strtold")) ||
- (NameLen == 7 && !strcmp(NameStr, "strncat")) ||
- (NameLen == 7 && !strcmp(NameStr, "strncpy")) ||
- (NameLen == 8 && !strcmp(NameStr, "strtoull"))) {
+ } else if (Name == "strcpy" ||
+ Name == "stpcpy" ||
+ Name == "strcat" ||
+ Name == "strtol" ||
+ Name == "strtod" ||
+ Name == "strtof" ||
+ Name == "strtoul" ||
+ Name == "strtoll" ||
+ Name == "strtold" ||
+ Name == "strncat" ||
+ Name == "strncpy" ||
+ Name == "strtoull") {
if (FTy->getNumParams() < 2 ||
!isa<PointerType>(FTy->getParamType(1)))
continue;
setDoesNotThrow(F);
setDoesNotCapture(F, 2);
- } else if (NameLen == 7 && !strcmp(NameStr, "strxfrm")) {
+ } else if (Name == "strxfrm") {
if (FTy->getNumParams() != 3 ||
!isa<PointerType>(FTy->getParamType(0)) ||
!isa<PointerType>(FTy->getParamType(1)))
setDoesNotThrow(F);
setDoesNotCapture(F, 1);
setDoesNotCapture(F, 2);
- } else if ((NameLen == 6 && !strcmp(NameStr, "strcmp")) ||
- (NameLen == 6 && !strcmp(NameStr, "strspn")) ||
- (NameLen == 7 && !strcmp(NameStr, "strncmp")) ||
- (NameLen == 7 && !strcmp(NameStr, "strcspn")) ||
- (NameLen == 7 && !strcmp(NameStr, "strcoll")) ||
- (NameLen == 10 && !strcmp(NameStr, "strcasecmp")) ||
- (NameLen == 11 && !strcmp(NameStr, "strncasecmp"))) {
+ } else if (Name == "strcmp" ||
+ Name == "strspn" ||
+ Name == "strncmp" ||
+ Name ==" strcspn" ||
+ Name == "strcoll" ||
+ Name == "strcasecmp" ||
+ Name == "strncasecmp") {
if (FTy->getNumParams() < 2 ||
!isa<PointerType>(FTy->getParamType(0)) ||
!isa<PointerType>(FTy->getParamType(1)))
setDoesNotThrow(F);
setDoesNotCapture(F, 1);
setDoesNotCapture(F, 2);
- } else if ((NameLen == 6 && !strcmp(NameStr, "strstr")) ||
- (NameLen == 7 && !strcmp(NameStr, "strpbrk"))) {
+ } else if (Name == "strstr" ||
+ Name == "strpbrk") {
if (FTy->getNumParams() != 2 ||
!isa<PointerType>(FTy->getParamType(1)))
continue;
setOnlyReadsMemory(F);
setDoesNotThrow(F);
setDoesNotCapture(F, 2);
- } else if ((NameLen == 6 && !strcmp(NameStr, "strtok")) ||
- (NameLen == 8 && !strcmp(NameStr, "strtok_r"))) {
+ } else if (Name == "strtok" ||
+ Name == "strtok_r") {
if (FTy->getNumParams() < 2 ||
!isa<PointerType>(FTy->getParamType(1)))
continue;
setDoesNotThrow(F);
setDoesNotCapture(F, 2);
- } else if ((NameLen == 5 && !strcmp(NameStr, "scanf")) ||
- (NameLen == 6 && !strcmp(NameStr, "setbuf")) ||
- (NameLen == 7 && !strcmp(NameStr, "setvbuf"))) {
+ } else if (Name == "scanf" ||
+ Name == "setbuf" ||
+ Name == "setvbuf") {
if (FTy->getNumParams() < 1 ||
!isa<PointerType>(FTy->getParamType(0)))
continue;
setDoesNotThrow(F);
setDoesNotCapture(F, 1);
- } else if ((NameLen == 6 && !strcmp(NameStr, "strdup")) ||
- (NameLen == 7 && !strcmp(NameStr, "strndup"))) {
+ } else if (Name == "strdup" ||
+ Name == "strndup") {
if (FTy->getNumParams() < 1 ||
!isa<PointerType>(FTy->getReturnType()) ||
!isa<PointerType>(FTy->getParamType(0)))
setDoesNotThrow(F);
setDoesNotAlias(F, 0);
setDoesNotCapture(F, 1);
- } else if ((NameLen == 4 && !strcmp(NameStr, "stat")) ||
- (NameLen == 6 && !strcmp(NameStr, "sscanf")) ||
- (NameLen == 7 && !strcmp(NameStr, "sprintf")) ||
- (NameLen == 7 && !strcmp(NameStr, "statvfs"))) {
+ } else if (Name == "stat" ||
+ Name == "sscanf" ||
+ Name == "sprintf" ||
+ Name == "statvfs") {
if (FTy->getNumParams() < 2 ||
!isa<PointerType>(FTy->getParamType(0)) ||
!isa<PointerType>(FTy->getParamType(1)))
setDoesNotThrow(F);
setDoesNotCapture(F, 1);
setDoesNotCapture(F, 2);
- } else if (NameLen == 8 && !strcmp(NameStr, "snprintf")) {
+ } else if (Name == "snprintf") {
if (FTy->getNumParams() != 3 ||
!isa<PointerType>(FTy->getParamType(0)) ||
!isa<PointerType>(FTy->getParamType(2)))
setDoesNotThrow(F);
setDoesNotCapture(F, 1);
setDoesNotCapture(F, 3);
- } else if (NameLen == 9 && !strcmp(NameStr, "setitimer")) {
+ } else if (Name == "setitimer") {
if (FTy->getNumParams() != 3 ||
!isa<PointerType>(FTy->getParamType(1)) ||
!isa<PointerType>(FTy->getParamType(2)))
setDoesNotThrow(F);
setDoesNotCapture(F, 2);
setDoesNotCapture(F, 3);
- } else if (NameLen == 6 && !strcmp(NameStr, "system")) {
+ } else if (Name == "system") {
if (FTy->getNumParams() != 1 ||
!isa<PointerType>(FTy->getParamType(0)))
continue;
}
break;
case 'm':
- if (NameLen == 6 && !strcmp(NameStr, "memcmp")) {
+ if (Name == "memcmp") {
if (FTy->getNumParams() != 3 ||
!isa<PointerType>(FTy->getParamType(0)) ||
!isa<PointerType>(FTy->getParamType(1)))
setDoesNotThrow(F);
setDoesNotCapture(F, 1);
setDoesNotCapture(F, 2);
- } else if ((NameLen == 6 && !strcmp(NameStr, "memchr")) ||
- (NameLen == 7 && !strcmp(NameStr, "memrchr"))) {
+ } else if (Name == "memchr" ||
+ Name == "memrchr") {
if (FTy->getNumParams() != 3)
continue;
setOnlyReadsMemory(F);
setDoesNotThrow(F);
- } else if ((NameLen == 4 && !strcmp(NameStr, "modf")) ||
- (NameLen == 5 && !strcmp(NameStr, "modff")) ||
- (NameLen == 5 && !strcmp(NameStr, "modfl")) ||
- (NameLen == 6 && !strcmp(NameStr, "memcpy")) ||
- (NameLen == 7 && !strcmp(NameStr, "memccpy")) ||
- (NameLen == 7 && !strcmp(NameStr, "memmove"))) {
+ } else if (Name == "modf" ||
+ Name == "modff" ||
+ Name == "modfl" ||
+ Name == "memcpy" ||
+ Name == "memccpy" ||
+ Name == "memmove") {
if (FTy->getNumParams() < 2 ||
!isa<PointerType>(FTy->getParamType(1)))
continue;
setDoesNotThrow(F);
setDoesNotCapture(F, 2);
- } else if (NameLen == 8 && !strcmp(NameStr, "memalign")) {
+ } else if (Name == "memalign") {
if (!isa<PointerType>(FTy->getReturnType()))
continue;
setDoesNotAlias(F, 0);
- } else if ((NameLen == 5 && !strcmp(NameStr, "mkdir")) ||
- (NameLen == 6 && !strcmp(NameStr, "mktime"))) {
+ } else if (Name == "mkdir" ||
+ Name == "mktime") {
if (FTy->getNumParams() == 0 ||
!isa<PointerType>(FTy->getParamType(0)))
continue;
}
break;
case 'r':
- if (NameLen == 7 && !strcmp(NameStr, "realloc")) {
+ if (Name == "realloc") {
if (FTy->getNumParams() != 2 ||
!isa<PointerType>(FTy->getParamType(0)) ||
!isa<PointerType>(FTy->getReturnType()))
setDoesNotThrow(F);
setDoesNotAlias(F, 0);
setDoesNotCapture(F, 1);
- } else if (NameLen == 4 && !strcmp(NameStr, "read")) {
+ } else if (Name == "read") {
if (FTy->getNumParams() != 3 ||
!isa<PointerType>(FTy->getParamType(1)))
continue;
// May throw; "read" is a valid pthread cancellation point.
setDoesNotCapture(F, 2);
- } else if ((NameLen == 5 && !strcmp(NameStr, "rmdir")) ||
- (NameLen == 6 && !strcmp(NameStr, "rewind")) ||
- (NameLen == 6 && !strcmp(NameStr, "remove")) ||
- (NameLen == 8 && !strcmp(NameStr, "realpath"))) {
+ } else if (Name == "rmdir" ||
+ Name == "rewind" ||
+ Name == "remove" ||
+ Name == "realpath") {
if (FTy->getNumParams() < 1 ||
!isa<PointerType>(FTy->getParamType(0)))
continue;
setDoesNotThrow(F);
setDoesNotCapture(F, 1);
- } else if ((NameLen == 6 && !strcmp(NameStr, "rename")) ||
- (NameLen == 8 && !strcmp(NameStr, "readlink"))) {
+ } else if (Name == "rename" ||
+ Name == "readlink") {
if (FTy->getNumParams() < 2 ||
!isa<PointerType>(FTy->getParamType(0)) ||
!isa<PointerType>(FTy->getParamType(1)))
}
break;
case 'w':
- if (NameLen == 5 && !strcmp(NameStr, "write")) {
+ if (Name == "write") {
if (FTy->getNumParams() != 3 ||
!isa<PointerType>(FTy->getParamType(1)))
continue;
}
break;
case 'b':
- if (NameLen == 5 && !strcmp(NameStr, "bcopy")) {
+ if (Name == "bcopy") {
if (FTy->getNumParams() != 3 ||
!isa<PointerType>(FTy->getParamType(0)) ||
!isa<PointerType>(FTy->getParamType(1)))
setDoesNotThrow(F);
setDoesNotCapture(F, 1);
setDoesNotCapture(F, 2);
- } else if (NameLen == 4 && !strcmp(NameStr, "bcmp")) {
+ } else if (Name == "bcmp") {
if (FTy->getNumParams() != 3 ||
!isa<PointerType>(FTy->getParamType(0)) ||
!isa<PointerType>(FTy->getParamType(1)))
setOnlyReadsMemory(F);
setDoesNotCapture(F, 1);
setDoesNotCapture(F, 2);
- } else if (NameLen == 5 && !strcmp(NameStr, "bzero")) {
+ } else if (Name == "bzero") {
if (FTy->getNumParams() != 2 ||
!isa<PointerType>(FTy->getParamType(0)))
continue;
}
break;
case 'c':
- if (NameLen == 6 && !strcmp(NameStr, "calloc")) {
+ if (Name == "calloc") {
if (FTy->getNumParams() != 2 ||
!isa<PointerType>(FTy->getReturnType()))
continue;
setDoesNotThrow(F);
setDoesNotAlias(F, 0);
- } else if ((NameLen == 5 && !strcmp(NameStr, "chmod")) ||
- (NameLen == 5 && !strcmp(NameStr, "chown")) ||
- (NameLen == 7 && !strcmp(NameStr, "ctermid")) ||
- (NameLen == 8 && !strcmp(NameStr, "clearerr")) ||
- (NameLen == 8 && !strcmp(NameStr, "closedir"))) {
+ } else if (Name == "chmod" ||
+ Name == "chown" ||
+ Name == "ctermid" ||
+ Name == "clearerr" ||
+ Name == "closedir") {
if (FTy->getNumParams() == 0 ||
!isa<PointerType>(FTy->getParamType(0)))
continue;
}
break;
case 'a':
- if ((NameLen == 4 && !strcmp(NameStr, "atoi")) ||
- (NameLen == 4 && !strcmp(NameStr, "atol")) ||
- (NameLen == 4 && !strcmp(NameStr, "atof")) ||
- (NameLen == 5 && !strcmp(NameStr, "atoll"))) {
+ if (Name == "atoi" ||
+ Name == "atol" ||
+ Name == "atof" ||
+ Name == "atoll") {
if (FTy->getNumParams() != 1 ||
!isa<PointerType>(FTy->getParamType(0)))
continue;
setDoesNotThrow(F);
setOnlyReadsMemory(F);
setDoesNotCapture(F, 1);
- } else if (NameLen == 6 && !strcmp(NameStr, "access")) {
+ } else if (Name == "access") {
if (FTy->getNumParams() != 2 ||
!isa<PointerType>(FTy->getParamType(0)))
continue;
}
break;
case 'f':
- if (NameLen == 5 && !strcmp(NameStr, "fopen")) {
+ if (Name == "fopen") {
if (FTy->getNumParams() != 2 ||
!isa<PointerType>(FTy->getReturnType()) ||
!isa<PointerType>(FTy->getParamType(0)) ||
setDoesNotAlias(F, 0);
setDoesNotCapture(F, 1);
setDoesNotCapture(F, 2);
- } else if (NameLen == 6 && !strcmp(NameStr, "fdopen")) {
+ } else if (Name == "fdopen") {
if (FTy->getNumParams() != 2 ||
!isa<PointerType>(FTy->getReturnType()) ||
!isa<PointerType>(FTy->getParamType(1)))
setDoesNotThrow(F);
setDoesNotAlias(F, 0);
setDoesNotCapture(F, 2);
- } else if ((NameLen == 4 && !strcmp(NameStr, "feof")) ||
- (NameLen == 4 && !strcmp(NameStr, "free")) ||
- (NameLen == 5 && !strcmp(NameStr, "fseek")) ||
- (NameLen == 5 && !strcmp(NameStr, "ftell")) ||
- (NameLen == 5 && !strcmp(NameStr, "fgetc")) ||
- (NameLen == 6 && !strcmp(NameStr, "fseeko")) ||
- (NameLen == 6 && !strcmp(NameStr, "ftello")) ||
- (NameLen == 6 && !strcmp(NameStr, "fileno")) ||
- (NameLen == 6 && !strcmp(NameStr, "fflush")) ||
- (NameLen == 6 && !strcmp(NameStr, "fclose")) ||
- (NameLen == 7 && !strcmp(NameStr, "fsetpos")) ||
- (NameLen == 9 && !strcmp(NameStr, "flockfile")) ||
- (NameLen == 11 && !strcmp(NameStr, "funlockfile")) ||
- (NameLen == 12 && !strcmp(NameStr, "ftrylockfile"))) {
+ } else if (Name == "feof" ||
+ Name == "free" ||
+ Name == "fseek" ||
+ Name == "ftell" ||
+ Name == "fgetc" ||
+ Name == "fseeko" ||
+ Name == "ftello" ||
+ Name == "fileno" ||
+ Name == "fflush" ||
+ Name == "fclose" ||
+ Name == "fsetpos" ||
+ Name == "flockfile" ||
+ Name == "funlockfile" ||
+ Name == "ftrylockfile") {
if (FTy->getNumParams() == 0 ||
!isa<PointerType>(FTy->getParamType(0)))
continue;
setDoesNotThrow(F);
setDoesNotCapture(F, 1);
- } else if (NameLen == 6 && !strcmp(NameStr, "ferror")) {
+ } else if (Name == "ferror") {
if (FTy->getNumParams() != 1 ||
!isa<PointerType>(FTy->getParamType(0)))
continue;
setDoesNotThrow(F);
setDoesNotCapture(F, 1);
setOnlyReadsMemory(F);
- } else if ((NameLen == 5 && !strcmp(NameStr, "fputc")) ||
- (NameLen == 5 && !strcmp(NameStr, "fstat")) ||
- (NameLen == 5 && !strcmp(NameStr, "frexp")) ||
- (NameLen == 6 && !strcmp(NameStr, "frexpf")) ||
- (NameLen == 6 && !strcmp(NameStr, "frexpl")) ||
- (NameLen == 8 && !strcmp(NameStr, "fstatvfs"))) {
+ } else if (Name == "fputc" ||
+ Name == "fstat" ||
+ Name == "frexp" ||
+ Name == "frexpf" ||
+ Name == "frexpl" ||
+ Name == "fstatvfs") {
if (FTy->getNumParams() != 2 ||
!isa<PointerType>(FTy->getParamType(1)))
continue;
setDoesNotThrow(F);
setDoesNotCapture(F, 2);
- } else if (NameLen == 5 && !strcmp(NameStr, "fgets")) {
+ } else if (Name == "fgets") {
if (FTy->getNumParams() != 3 ||
!isa<PointerType>(FTy->getParamType(0)) ||
!isa<PointerType>(FTy->getParamType(2)))
continue;
setDoesNotThrow(F);
setDoesNotCapture(F, 3);
- } else if ((NameLen == 5 && !strcmp(NameStr, "fread")) ||
- (NameLen == 6 && !strcmp(NameStr, "fwrite"))) {
+ } else if (Name == "fread" ||
+ Name == "fwrite") {
if (FTy->getNumParams() != 4 ||
!isa<PointerType>(FTy->getParamType(0)) ||
!isa<PointerType>(FTy->getParamType(3)))
setDoesNotThrow(F);
setDoesNotCapture(F, 1);
setDoesNotCapture(F, 4);
- } else if ((NameLen == 5 && !strcmp(NameStr, "fputs")) ||
- (NameLen == 6 && !strcmp(NameStr, "fscanf")) ||
- (NameLen == 7 && !strcmp(NameStr, "fprintf")) ||
- (NameLen == 7 && !strcmp(NameStr, "fgetpos"))) {
+ } else if (Name == "fputs" ||
+ Name == "fscanf" ||
+ Name == "fprintf" ||
+ Name == "fgetpos") {
if (FTy->getNumParams() < 2 ||
!isa<PointerType>(FTy->getParamType(0)) ||
!isa<PointerType>(FTy->getParamType(1)))
}
break;
case 'g':
- if ((NameLen == 4 && !strcmp(NameStr, "getc")) ||
- (NameLen == 10 && !strcmp(NameStr, "getlogin_r")) ||
- (NameLen == 13 && !strcmp(NameStr, "getc_unlocked"))) {
+ if (Name == "getc" ||
+ Name == "getlogin_r" ||
+ Name == "getc_unlocked") {
if (FTy->getNumParams() == 0 ||
!isa<PointerType>(FTy->getParamType(0)))
continue;
setDoesNotThrow(F);
setDoesNotCapture(F, 1);
- } else if (NameLen == 6 && !strcmp(NameStr, "getenv")) {
+ } else if (Name == "getenv") {
if (FTy->getNumParams() != 1 ||
!isa<PointerType>(FTy->getParamType(0)))
continue;
setDoesNotThrow(F);
setOnlyReadsMemory(F);
setDoesNotCapture(F, 1);
- } else if ((NameLen == 4 && !strcmp(NameStr, "gets")) ||
- (NameLen == 7 && !strcmp(NameStr, "getchar"))) {
+ } else if (Name == "gets" ||
+ Name == "getchar") {
setDoesNotThrow(F);
- } else if (NameLen == 9 && !strcmp(NameStr, "getitimer")) {
+ } else if (Name == "getitimer") {
if (FTy->getNumParams() != 2 ||
!isa<PointerType>(FTy->getParamType(1)))
continue;
setDoesNotThrow(F);
setDoesNotCapture(F, 2);
- } else if (NameLen == 8 && !strcmp(NameStr, "getpwnam")) {
+ } else if (Name == "getpwnam") {
if (FTy->getNumParams() != 1 ||
!isa<PointerType>(FTy->getParamType(0)))
continue;
}
break;
case 'u':
- if (NameLen == 6 && !strcmp(NameStr, "ungetc")) {
+ if (Name == "ungetc") {
if (FTy->getNumParams() != 2 ||
!isa<PointerType>(FTy->getParamType(1)))
continue;
setDoesNotThrow(F);
setDoesNotCapture(F, 2);
- } else if ((NameLen == 5 && !strcmp(NameStr, "uname")) ||
- (NameLen == 6 && !strcmp(NameStr, "unlink")) ||
- (NameLen == 8 && !strcmp(NameStr, "unsetenv"))) {
+ } else if (Name == "uname" ||
+ Name == "unlink" ||
+ Name == "unsetenv") {
if (FTy->getNumParams() != 1 ||
!isa<PointerType>(FTy->getParamType(0)))
continue;
setDoesNotThrow(F);
setDoesNotCapture(F, 1);
- } else if ((NameLen == 5 && !strcmp(NameStr, "utime")) ||
- (NameLen == 6 && !strcmp(NameStr, "utimes"))) {
+ } else if (Name == "utime" ||
+ Name == "utimes") {
if (FTy->getNumParams() != 2 ||
!isa<PointerType>(FTy->getParamType(0)) ||
!isa<PointerType>(FTy->getParamType(1)))
}
break;
case 'p':
- if (NameLen == 4 && !strcmp(NameStr, "putc")) {
+ if (Name == "putc") {
if (FTy->getNumParams() != 2 ||
!isa<PointerType>(FTy->getParamType(1)))
continue;
setDoesNotThrow(F);
setDoesNotCapture(F, 2);
- } else if ((NameLen == 4 && !strcmp(NameStr, "puts")) ||
- (NameLen == 6 && !strcmp(NameStr, "printf")) ||
- (NameLen == 6 && !strcmp(NameStr, "perror"))) {
+ } else if (Name == "puts" ||
+ Name == "printf" ||
+ Name == "perror") {
if (FTy->getNumParams() != 1 ||
!isa<PointerType>(FTy->getParamType(0)))
continue;
setDoesNotThrow(F);
setDoesNotCapture(F, 1);
- } else if ((NameLen == 5 && !strcmp(NameStr, "pread")) ||
- (NameLen == 6 && !strcmp(NameStr, "pwrite"))) {
+ } else if (Name == "pread" ||
+ Name == "pwrite") {
if (FTy->getNumParams() != 4 ||
!isa<PointerType>(FTy->getParamType(1)))
continue;
// May throw; these are valid pthread cancellation points.
setDoesNotCapture(F, 2);
- } else if (NameLen == 7 && !strcmp(NameStr, "putchar")) {
+ } else if (Name == "putchar") {
setDoesNotThrow(F);
- } else if (NameLen == 5 && !strcmp(NameStr, "popen")) {
+ } else if (Name == "popen") {
if (FTy->getNumParams() != 2 ||
!isa<PointerType>(FTy->getReturnType()) ||
!isa<PointerType>(FTy->getParamType(0)) ||
setDoesNotAlias(F, 0);
setDoesNotCapture(F, 1);
setDoesNotCapture(F, 2);
- } else if (NameLen == 6 && !strcmp(NameStr, "pclose")) {
+ } else if (Name == "pclose") {
if (FTy->getNumParams() != 1 ||
!isa<PointerType>(FTy->getParamType(0)))
continue;
}
break;
case 'v':
- if (NameLen == 6 && !strcmp(NameStr, "vscanf")) {
+ if (Name == "vscanf") {
if (FTy->getNumParams() != 2 ||
!isa<PointerType>(FTy->getParamType(1)))
continue;
setDoesNotThrow(F);
setDoesNotCapture(F, 1);
- } else if ((NameLen == 7 && !strcmp(NameStr, "vsscanf")) ||
- (NameLen == 7 && !strcmp(NameStr, "vfscanf"))) {
+ } else if (Name == "vsscanf" ||
+ Name == "vfscanf") {
if (FTy->getNumParams() != 3 ||
!isa<PointerType>(FTy->getParamType(1)) ||
!isa<PointerType>(FTy->getParamType(2)))
setDoesNotThrow(F);
setDoesNotCapture(F, 1);
setDoesNotCapture(F, 2);
- } else if (NameLen == 6 && !strcmp(NameStr, "valloc")) {
+ } else if (Name == "valloc") {
if (!isa<PointerType>(FTy->getReturnType()))
continue;
setDoesNotThrow(F);
setDoesNotAlias(F, 0);
- } else if (NameLen == 7 && !strcmp(NameStr, "vprintf")) {
+ } else if (Name == "vprintf") {
if (FTy->getNumParams() != 2 ||
!isa<PointerType>(FTy->getParamType(0)))
continue;
setDoesNotThrow(F);
setDoesNotCapture(F, 1);
- } else if ((NameLen == 8 && !strcmp(NameStr, "vfprintf")) ||
- (NameLen == 8 && !strcmp(NameStr, "vsprintf"))) {
+ } else if (Name == "vfprintf" ||
+ Name == "vsprintf") {
if (FTy->getNumParams() != 3 ||
!isa<PointerType>(FTy->getParamType(0)) ||
!isa<PointerType>(FTy->getParamType(1)))
setDoesNotThrow(F);
setDoesNotCapture(F, 1);
setDoesNotCapture(F, 2);
- } else if (NameLen == 9 && !strcmp(NameStr, "vsnprintf")) {
+ } else if (Name == "vsnprintf") {
if (FTy->getNumParams() != 4 ||
!isa<PointerType>(FTy->getParamType(0)) ||
!isa<PointerType>(FTy->getParamType(2)))
}
break;
case 'o':
- if (NameLen == 4 && !strcmp(NameStr, "open")) {
+ if (Name == "open") {
if (FTy->getNumParams() < 2 ||
!isa<PointerType>(FTy->getParamType(0)))
continue;
// May throw; "open" is a valid pthread cancellation point.
setDoesNotCapture(F, 1);
- } else if (NameLen == 7 && !strcmp(NameStr, "opendir")) {
+ } else if (Name == "opendir") {
if (FTy->getNumParams() != 1 ||
!isa<PointerType>(FTy->getReturnType()) ||
!isa<PointerType>(FTy->getParamType(0)))
}
break;
case 't':
- if (NameLen == 7 && !strcmp(NameStr, "tmpfile")) {
+ if (Name == "tmpfile") {
if (!isa<PointerType>(FTy->getReturnType()))
continue;
setDoesNotThrow(F);
setDoesNotAlias(F, 0);
- } else if (NameLen == 5 && !strcmp(NameStr, "times")) {
+ } else if (Name == "times") {
if (FTy->getNumParams() != 1 ||
!isa<PointerType>(FTy->getParamType(0)))
continue;
}
break;
case 'h':
- if ((NameLen == 5 && !strcmp(NameStr, "htonl")) ||
- (NameLen == 5 && !strcmp(NameStr, "htons"))) {
+ if (Name == "htonl" ||
+ Name == "htons") {
setDoesNotThrow(F);
setDoesNotAccessMemory(F);
}
break;
case 'n':
- if ((NameLen == 5 && !strcmp(NameStr, "ntohl")) ||
- (NameLen == 5 && !strcmp(NameStr, "ntohs"))) {
+ if (Name == "ntohl" ||
+ Name == "ntohs") {
setDoesNotThrow(F);
setDoesNotAccessMemory(F);
}
break;
case 'l':
- if (NameLen == 5 && !strcmp(NameStr, "lstat")) {
+ if (Name == "lstat") {
if (FTy->getNumParams() != 2 ||
!isa<PointerType>(FTy->getParamType(0)) ||
!isa<PointerType>(FTy->getParamType(1)))
setDoesNotThrow(F);
setDoesNotCapture(F, 1);
setDoesNotCapture(F, 2);
- } else if (NameLen == 6 && !strcmp(NameStr, "lchown")) {
+ } else if (Name == "lchown") {
if (FTy->getNumParams() != 3 ||
!isa<PointerType>(FTy->getParamType(0)))
continue;
}
break;
case 'q':
- if (NameLen == 5 && !strcmp(NameStr, "qsort")) {
+ if (Name == "qsort") {
if (FTy->getNumParams() != 4 ||
!isa<PointerType>(FTy->getParamType(3)))
continue;
}
break;
case '_':
- if ((NameLen == 8 && !strcmp(NameStr, "__strdup")) ||
- (NameLen == 9 && !strcmp(NameStr, "__strndup"))) {
+ if (Name == "__strdup" ||
+ Name == "__strndup") {
if (FTy->getNumParams() < 1 ||
!isa<PointerType>(FTy->getReturnType()) ||
!isa<PointerType>(FTy->getParamType(0)))
setDoesNotThrow(F);
setDoesNotAlias(F, 0);
setDoesNotCapture(F, 1);
- } else if (NameLen == 10 && !strcmp(NameStr, "__strtok_r")) {
+ } else if (Name == "__strtok_r") {
if (FTy->getNumParams() != 3 ||
!isa<PointerType>(FTy->getParamType(1)))
continue;
setDoesNotThrow(F);
setDoesNotCapture(F, 2);
- } else if (NameLen == 8 && !strcmp(NameStr, "_IO_getc")) {
+ } else if (Name == "_IO_getc") {
if (FTy->getNumParams() != 1 ||
!isa<PointerType>(FTy->getParamType(0)))
continue;
setDoesNotThrow(F);
setDoesNotCapture(F, 1);
- } else if (NameLen == 8 && !strcmp(NameStr, "_IO_putc")) {
+ } else if (Name == "_IO_putc") {
if (FTy->getNumParams() != 2 ||
!isa<PointerType>(FTy->getParamType(1)))
continue;
}
break;
case 1:
- if (NameLen == 15 && !strcmp(NameStr, "\1__isoc99_scanf")) {
+ if (Name == "\1__isoc99_scanf") {
if (FTy->getNumParams() < 1 ||
!isa<PointerType>(FTy->getParamType(0)))
continue;
setDoesNotThrow(F);
setDoesNotCapture(F, 1);
- } else if ((NameLen == 7 && !strcmp(NameStr, "\1stat64")) ||
- (NameLen == 8 && !strcmp(NameStr, "\1lstat64")) ||
- (NameLen == 10 && !strcmp(NameStr, "\1statvfs64")) ||
- (NameLen == 16 && !strcmp(NameStr, "\1__isoc99_sscanf"))) {
+ } else if (Name == "\1stat64" ||
+ Name == "\1lstat64" ||
+ Name == "\1statvfs64" ||
+ Name == "\1__isoc99_sscanf") {
if (FTy->getNumParams() < 1 ||
!isa<PointerType>(FTy->getParamType(0)) ||
!isa<PointerType>(FTy->getParamType(1)))
setDoesNotThrow(F);
setDoesNotCapture(F, 1);
setDoesNotCapture(F, 2);
- } else if (NameLen == 8 && !strcmp(NameStr, "\1fopen64")) {
+ } else if (Name == "\1fopen64") {
if (FTy->getNumParams() != 2 ||
!isa<PointerType>(FTy->getReturnType()) ||
!isa<PointerType>(FTy->getParamType(0)) ||
setDoesNotAlias(F, 0);
setDoesNotCapture(F, 1);
setDoesNotCapture(F, 2);
- } else if ((NameLen == 9 && !strcmp(NameStr, "\1fseeko64")) ||
- (NameLen == 9 && !strcmp(NameStr, "\1ftello64"))) {
+ } else if (Name == "\1fseeko64" ||
+ Name == "\1ftello64") {
if (FTy->getNumParams() == 0 ||
!isa<PointerType>(FTy->getParamType(0)))
continue;
setDoesNotThrow(F);
setDoesNotCapture(F, 1);
- } else if (NameLen == 10 && !strcmp(NameStr, "\1tmpfile64")) {
+ } else if (Name == "\1tmpfile64") {
if (!isa<PointerType>(FTy->getReturnType()))
continue;
setDoesNotThrow(F);
setDoesNotAlias(F, 0);
- } else if ((NameLen == 8 && !strcmp(NameStr, "\1fstat64")) ||
- (NameLen == 11 && !strcmp(NameStr, "\1fstatvfs64"))) {
+ } else if (Name == "\1fstat64" ||
+ Name == "\1fstatvfs64") {
if (FTy->getNumParams() != 2 ||
!isa<PointerType>(FTy->getParamType(1)))
continue;
setDoesNotThrow(F);
setDoesNotCapture(F, 2);
- } else if (NameLen == 7 && !strcmp(NameStr, "\1open64")) {
+ } else if (Name == "\1open64") {
if (FTy->getNumParams() < 2 ||
!isa<PointerType>(FTy->getParamType(0)))
continue;
// Print passes managed by this manager
void dumpPassStructure(unsigned Offset) {
- llvm::cerr << std::string(Offset*2, ' ') << "BasicBlockPass Manager\n";
+ llvm::errs() << std::string(Offset*2, ' ') << "BasicBlockPass Manager\n";
for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index) {
BasicBlockPass *BP = getContainedPass(Index);
BP->dumpPassStructure(Offset + 1);
// Print passes managed by this manager
void dumpPassStructure(unsigned Offset) {
- llvm::cerr << std::string(Offset*2, ' ') << "ModulePass Manager\n";
+ llvm::errs() << std::string(Offset*2, ' ') << "ModulePass Manager\n";
for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index) {
ModulePass *MP = getContainedPass(Index);
MP->dumpPassStructure(Offset + 1);
if (PassDebugging < Arguments)
return;
- cerr << "Pass Arguments: ";
+ errs() << "Pass Arguments: ";
for (SmallVector<PMDataManager *, 8>::const_iterator I = PassManagers.begin(),
E = PassManagers.end(); I != E; ++I)
(*I)->dumpPassArguments();
- cerr << "\n";
+ errs() << "\n";
}
void PMTopLevelManager::initializeAllAnalysisInfo() {
DominatorTree OtherDT;
OtherDT.getBase().recalculate(F);
if (DT->compare(OtherDT)) {
- cerr << "Dominator Information for " << F.getNameStart() << "\n";
- cerr << "Pass '" << P.getPassName() << "'\n";
- cerr << "----- Valid -----\n";
+ errs() << "Dominator Information for " << F.getName() << "\n";
+ errs() << "Pass '" << P.getPassName() << "'\n";
+ errs() << "----- Valid -----\n";
OtherDT.dump();
- cerr << "----- Invalid -----\n";
+ errs() << "----- Invalid -----\n";
DT->dump();
llvm_unreachable("Invalid dominator info");
}
std::vector<BasicBlock*> DTRoots = DT->getRoots();
OtherDF.calculate(*DT, DT->getNode(DTRoots[0]));
if (DF->compare(OtherDF)) {
- cerr << "Dominator Information for " << F.getNameStart() << "\n";
- cerr << "Pass '" << P.getPassName() << "'\n";
- cerr << "----- Valid -----\n";
+ errs() << "Dominator Information for " << F.getName() << "\n";
+ errs() << "Pass '" << P.getPassName() << "'\n";
+ errs() << "----- Valid -----\n";
OtherDF.dump();
- cerr << "----- Invalid -----\n";
+ errs() << "----- Invalid -----\n";
DF->dump();
llvm_unreachable("Invalid dominator info");
}
// Remove this analysis
if (PassDebugging >= Details) {
Pass *S = Info->second;
- cerr << " -- '" << P->getPassName() << "' is not preserving '";
- cerr << S->getPassName() << "'\n";
+ errs() << " -- '" << P->getPassName() << "' is not preserving '";
+ errs() << S->getPassName() << "'\n";
}
AvailableAnalysis.erase(Info);
}
}
/// Remove analysis passes that are not used any longer
-void PMDataManager::removeDeadPasses(Pass *P, const char *Msg,
+void PMDataManager::removeDeadPasses(Pass *P, const StringRef &Msg,
enum PassDebuggingString DBG_STR) {
SmallVector<Pass *, 12> DeadPasses;
TPM->collectLastUses(DeadPasses, P);
if (PassDebugging >= Details && !DeadPasses.empty()) {
- cerr << " -*- '" << P->getPassName();
- cerr << "' is the last user of following pass instances.";
- cerr << " Free these instances\n";
+ errs() << " -*- '" << P->getPassName();
+ errs() << "' is the last user of following pass instances.";
+ errs() << " Free these instances\n";
}
for (SmallVector<Pass *, 12>::iterator I = DeadPasses.begin(),
for (SmallVector<Pass *, 12>::iterator I = LUses.begin(),
E = LUses.end(); I != E; ++I) {
- llvm::cerr << "--" << std::string(Offset*2, ' ');
+ llvm::errs() << "--" << std::string(Offset*2, ' ');
(*I)->dumpPassStructure(0);
}
}
else
if (const PassInfo *PI = (*I)->getPassInfo())
if (!PI->isAnalysisGroup())
- cerr << " -" << PI->getPassArgument();
+ errs() << " -" << PI->getPassArgument();
}
}
void PMDataManager::dumpPassInfo(Pass *P, enum PassDebuggingString S1,
enum PassDebuggingString S2,
- const char *Msg) {
+ const StringRef &Msg) {
if (PassDebugging < Executions)
return;
- cerr << (void*)this << std::string(getDepth()*2+1, ' ');
+ errs() << (void*)this << std::string(getDepth()*2+1, ' ');
switch (S1) {
case EXECUTION_MSG:
- cerr << "Executing Pass '" << P->getPassName();
+ errs() << "Executing Pass '" << P->getPassName();
break;
case MODIFICATION_MSG:
- cerr << "Made Modification '" << P->getPassName();
+ errs() << "Made Modification '" << P->getPassName();
break;
case FREEING_MSG:
- cerr << " Freeing Pass '" << P->getPassName();
+ errs() << " Freeing Pass '" << P->getPassName();
break;
default:
break;
}
switch (S2) {
case ON_BASICBLOCK_MSG:
- cerr << "' on BasicBlock '" << Msg << "'...\n";
+ errs() << "' on BasicBlock '" << Msg << "'...\n";
break;
case ON_FUNCTION_MSG:
- cerr << "' on Function '" << Msg << "'...\n";
+ errs() << "' on Function '" << Msg << "'...\n";
break;
case ON_MODULE_MSG:
- cerr << "' on Module '" << Msg << "'...\n";
+ errs() << "' on Module '" << Msg << "'...\n";
break;
case ON_LOOP_MSG:
- cerr << "' on Loop " << Msg << "'...\n";
+ errs() << "' on Loop " << Msg << "'...\n";
break;
case ON_CG_MSG:
- cerr << "' on Call Graph " << Msg << "'...\n";
+ errs() << "' on Call Graph " << Msg << "'...\n";
break;
default:
break;
dumpAnalysisUsage("Preserved", P, analysisUsage.getPreservedSet());
}
-void PMDataManager::dumpAnalysisUsage(const char *Msg, const Pass *P,
+void PMDataManager::dumpAnalysisUsage(const StringRef &Msg, const Pass *P,
const AnalysisUsage::VectorType &Set) const {
assert(PassDebugging >= Details);
if (Set.empty())
return;
- cerr << (void*)P << std::string(getDepth()*2+3, ' ') << Msg << " Analyses:";
+ errs() << (void*)P << std::string(getDepth()*2+3, ' ') << Msg << " Analyses:";
for (unsigned i = 0; i != Set.size(); ++i) {
- if (i) cerr << ",";
- cerr << " " << Set[i]->getPassName();
+ if (i) errs() << ",";
+ errs() << " " << Set[i]->getPassName();
}
- cerr << "\n";
+ errs() << "\n";
}
/// Add RequiredPass into list of lower level passes required by pass P.
// checks whether any lower level manager will be able to provide this
// analysis info on demand or not.
#ifndef NDEBUG
- cerr << "Unable to schedule '" << RequiredPass->getPassName();
- cerr << "' required by '" << P->getPassName() << "'\n";
+ errs() << "Unable to schedule '" << RequiredPass->getPassName();
+ errs() << "' required by '" << P->getPassName() << "'\n";
#endif
llvm_unreachable("Unable to schedule pass");
}
for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index) {
BasicBlockPass *BP = getContainedPass(Index);
- dumpPassInfo(BP, EXECUTION_MSG, ON_BASICBLOCK_MSG, I->getNameStart());
+ dumpPassInfo(BP, EXECUTION_MSG, ON_BASICBLOCK_MSG, I->getName());
dumpRequiredSet(BP);
initializeAnalysisImpl(BP);
if (Changed)
dumpPassInfo(BP, MODIFICATION_MSG, ON_BASICBLOCK_MSG,
- I->getNameStart());
+ I->getName());
dumpPreservedSet(BP);
verifyPreservedAnalysis(BP);
removeNotPreservedAnalysis(BP);
recordAvailableAnalysis(BP);
- removeDeadPasses(BP, I->getNameStart(), ON_BASICBLOCK_MSG);
+ removeDeadPasses(BP, I->getName(), ON_BASICBLOCK_MSG);
}
return Changed |= doFinalization(F);
char FPPassManager::ID = 0;
/// Print passes managed by this manager
void FPPassManager::dumpPassStructure(unsigned Offset) {
- llvm::cerr << std::string(Offset*2, ' ') << "FunctionPass Manager\n";
+ llvm::errs() << std::string(Offset*2, ' ') << "FunctionPass Manager\n";
for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index) {
FunctionPass *FP = getContainedPass(Index);
FP->dumpPassStructure(Offset + 1);
for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index) {
FunctionPass *FP = getContainedPass(Index);
- dumpPassInfo(FP, EXECUTION_MSG, ON_FUNCTION_MSG, F.getNameStart());
+ dumpPassInfo(FP, EXECUTION_MSG, ON_FUNCTION_MSG, F.getName());
dumpRequiredSet(FP);
initializeAnalysisImpl(FP);
}
if (Changed)
- dumpPassInfo(FP, MODIFICATION_MSG, ON_FUNCTION_MSG, F.getNameStart());
+ dumpPassInfo(FP, MODIFICATION_MSG, ON_FUNCTION_MSG, F.getName());
dumpPreservedSet(FP);
verifyPreservedAnalysis(FP);
removeNotPreservedAnalysis(FP);
recordAvailableAnalysis(FP);
- removeDeadPasses(FP, F.getNameStart(), ON_FUNCTION_MSG);
+ removeDeadPasses(FP, F.getName(), ON_FUNCTION_MSG);
// If dominator information is available then verify the info if requested.
verifyDomInfo(*FP, F);