summaryrefslogtreecommitdiffstats
path: root/lib/Analysis
diff options
context:
space:
mode:
authorrdivacky <rdivacky@FreeBSD.org>2010-01-01 10:31:22 +0000
committerrdivacky <rdivacky@FreeBSD.org>2010-01-01 10:31:22 +0000
commita16c51cee9225a354c999dd1076d5dba2aa79807 (patch)
treedba00119388b84f9f44e6ec5e9129f807fd79ca3 /lib/Analysis
parent40a6fcdb85efd93fe0e36c9552cfb0b18b5eacd6 (diff)
downloadFreeBSD-src-a16c51cee9225a354c999dd1076d5dba2aa79807.zip
FreeBSD-src-a16c51cee9225a354c999dd1076d5dba2aa79807.tar.gz
Update LLVM to 92395.
Diffstat (limited to 'lib/Analysis')
-rw-r--r--lib/Analysis/AliasAnalysisCounter.cpp1
-rw-r--r--lib/Analysis/AliasAnalysisEvaluator.cpp1
-rw-r--r--lib/Analysis/AliasSetTracker.cpp5
-rw-r--r--lib/Analysis/DbgInfoPrinter.cpp18
-rw-r--r--lib/Analysis/DebugInfo.cpp706
-rw-r--r--lib/Analysis/IPA/Andersens.cpp106
-rw-r--r--lib/Analysis/IPA/CallGraph.cpp5
-rw-r--r--lib/Analysis/IPA/CallGraphSCCPass.cpp8
-rw-r--r--lib/Analysis/IVUsers.cpp20
-rw-r--r--lib/Analysis/InstCount.cpp1
-rw-r--r--lib/Analysis/LazyValueInfo.cpp14
-rw-r--r--lib/Analysis/LoopDependenceAnalysis.cpp14
-rw-r--r--lib/Analysis/LoopInfo.cpp2
-rw-r--r--lib/Analysis/MemoryDependenceAnalysis.cpp83
-rw-r--r--lib/Analysis/PHITransAddr.cpp7
-rw-r--r--lib/Analysis/PostDominators.cpp2
-rw-r--r--lib/Analysis/ProfileEstimatorPass.cpp20
-rw-r--r--lib/Analysis/ProfileInfo.cpp34
-rw-r--r--lib/Analysis/ProfileInfoLoaderPass.cpp10
-rw-r--r--lib/Analysis/ProfileVerifierPass.cpp16
-rw-r--r--lib/Analysis/ScalarEvolution.cpp72
-rw-r--r--lib/Analysis/SparsePropagation.cpp11
-rw-r--r--lib/Analysis/Trace.cpp3
-rw-r--r--lib/Analysis/ValueTracking.cpp5
24 files changed, 560 insertions, 604 deletions
diff --git a/lib/Analysis/AliasAnalysisCounter.cpp b/lib/Analysis/AliasAnalysisCounter.cpp
index 030bcd2..ae28b55 100644
--- a/lib/Analysis/AliasAnalysisCounter.cpp
+++ b/lib/Analysis/AliasAnalysisCounter.cpp
@@ -17,6 +17,7 @@
#include "llvm/Analysis/AliasAnalysis.h"
#include "llvm/Assembly/Writer.h"
#include "llvm/Support/CommandLine.h"
+#include "llvm/Support/Debug.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/raw_ostream.h"
using namespace llvm;
diff --git a/lib/Analysis/AliasAnalysisEvaluator.cpp b/lib/Analysis/AliasAnalysisEvaluator.cpp
index 6a2564c..6b0a956 100644
--- a/lib/Analysis/AliasAnalysisEvaluator.cpp
+++ b/lib/Analysis/AliasAnalysisEvaluator.cpp
@@ -26,6 +26,7 @@
#include "llvm/Analysis/AliasAnalysis.h"
#include "llvm/Assembly/Writer.h"
#include "llvm/Target/TargetData.h"
+#include "llvm/Support/Debug.h"
#include "llvm/Support/InstIterator.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/raw_ostream.h"
diff --git a/lib/Analysis/AliasSetTracker.cpp b/lib/Analysis/AliasSetTracker.cpp
index 6634600..02aff50 100644
--- a/lib/Analysis/AliasSetTracker.cpp
+++ b/lib/Analysis/AliasSetTracker.cpp
@@ -19,6 +19,7 @@
#include "llvm/Type.h"
#include "llvm/Target/TargetData.h"
#include "llvm/Assembly/Writer.h"
+#include "llvm/Support/Debug.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/InstIterator.h"
#include "llvm/Support/Format.h"
@@ -549,8 +550,8 @@ void AliasSetTracker::print(raw_ostream &OS) const {
OS << "\n";
}
-void AliasSet::dump() const { print(errs()); }
-void AliasSetTracker::dump() const { print(errs()); }
+void AliasSet::dump() const { print(dbgs()); }
+void AliasSetTracker::dump() const { print(dbgs()); }
//===----------------------------------------------------------------------===//
// ASTCallbackVH Class Implementation
diff --git a/lib/Analysis/DbgInfoPrinter.cpp b/lib/Analysis/DbgInfoPrinter.cpp
index ab92e3f..7d72b38 100644
--- a/lib/Analysis/DbgInfoPrinter.cpp
+++ b/lib/Analysis/DbgInfoPrinter.cpp
@@ -19,10 +19,10 @@
#include "llvm/Pass.h"
#include "llvm/Function.h"
#include "llvm/IntrinsicInst.h"
+#include "llvm/Metadata.h"
#include "llvm/Assembly/Writer.h"
#include "llvm/Analysis/DebugInfo.h"
#include "llvm/Analysis/Passes.h"
-#include "llvm/Analysis/ValueTracking.h"
#include "llvm/Support/CFG.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/raw_ostream.h"
@@ -75,18 +75,16 @@ void PrintDbgInfo::printVariableDeclaration(const Value *V) {
}
void PrintDbgInfo::printStopPoint(const DbgStopPointInst *DSI) {
- if (PrintDirectory) {
- std::string dir;
- GetConstantStringInfo(DSI->getDirectory(), dir);
- Out << dir << "/";
- }
+ if (PrintDirectory)
+ if (MDString *Str = dyn_cast<MDString>(DSI->getDirectory()))
+ Out << Str->getString() << '/';
- std::string file;
- GetConstantStringInfo(DSI->getFileName(), file);
- Out << file << ":" << DSI->getLine();
+ if (MDString *Str = dyn_cast<MDString>(DSI->getFileName()))
+ Out << Str->getString();
+ Out << ':' << DSI->getLine();
if (unsigned Col = DSI->getColumn())
- Out << ":" << Col;
+ Out << ':' << Col;
}
void PrintDbgInfo::printFuncStart(const DbgFuncStartInst *FS) {
diff --git a/lib/Analysis/DebugInfo.cpp b/lib/Analysis/DebugInfo.cpp
index 1c9f500..de2d839 100644
--- a/lib/Analysis/DebugInfo.cpp
+++ b/lib/Analysis/DebugInfo.cpp
@@ -13,15 +13,16 @@
//===----------------------------------------------------------------------===//
#include "llvm/Analysis/DebugInfo.h"
+#include "llvm/Target/TargetMachine.h" // FIXME: LAYERING VIOLATION!
#include "llvm/Constants.h"
#include "llvm/DerivedTypes.h"
#include "llvm/Intrinsics.h"
#include "llvm/IntrinsicInst.h"
#include "llvm/Instructions.h"
-#include "llvm/LLVMContext.h"
#include "llvm/Module.h"
#include "llvm/Analysis/ValueTracking.h"
#include "llvm/ADT/SmallPtrSet.h"
+#include "llvm/Support/Debug.h"
#include "llvm/Support/Dwarf.h"
#include "llvm/Support/DebugLoc.h"
#include "llvm/Support/raw_ostream.h"
@@ -34,7 +35,7 @@ using namespace llvm::dwarf;
/// ValidDebugInfo - Return true if V represents valid debug info value.
/// FIXME : Add DIDescriptor.isValid()
-bool DIDescriptor::ValidDebugInfo(MDNode *N, CodeGenOpt::Level OptLevel) {
+bool DIDescriptor::ValidDebugInfo(MDNode *N, unsigned OptLevel) {
if (!N)
return false;
@@ -45,8 +46,7 @@ bool DIDescriptor::ValidDebugInfo(MDNode *N, CodeGenOpt::Level OptLevel) {
if (Version != LLVMDebugVersion && Version != LLVMDebugVersion6)
return false;
- unsigned Tag = DI.getTag();
- switch (Tag) {
+ switch (DI.getTag()) {
case DW_TAG_variable:
assert(DIVariable(N).Verify() && "Invalid DebugInfo value");
break;
@@ -83,8 +83,8 @@ DIDescriptor::getStringField(unsigned Elt) const {
if (DbgNode == 0)
return StringRef();
- if (Elt < DbgNode->getNumElements())
- if (MDString *MDS = dyn_cast_or_null<MDString>(DbgNode->getElement(Elt)))
+ if (Elt < DbgNode->getNumOperands())
+ if (MDString *MDS = dyn_cast_or_null<MDString>(DbgNode->getOperand(Elt)))
return MDS->getString();
return StringRef();
@@ -94,8 +94,8 @@ uint64_t DIDescriptor::getUInt64Field(unsigned Elt) const {
if (DbgNode == 0)
return 0;
- if (Elt < DbgNode->getNumElements())
- if (ConstantInt *CI = dyn_cast<ConstantInt>(DbgNode->getElement(Elt)))
+ if (Elt < DbgNode->getNumOperands())
+ if (ConstantInt *CI = dyn_cast<ConstantInt>(DbgNode->getOperand(Elt)))
return CI->getZExtValue();
return 0;
@@ -105,8 +105,8 @@ DIDescriptor DIDescriptor::getDescriptorField(unsigned Elt) const {
if (DbgNode == 0)
return DIDescriptor();
- if (Elt < DbgNode->getNumElements() && DbgNode->getElement(Elt))
- return DIDescriptor(dyn_cast<MDNode>(DbgNode->getElement(Elt)));
+ if (Elt < DbgNode->getNumOperands() && DbgNode->getOperand(Elt))
+ return DIDescriptor(dyn_cast<MDNode>(DbgNode->getOperand(Elt)));
return DIDescriptor();
}
@@ -115,11 +115,16 @@ GlobalVariable *DIDescriptor::getGlobalVariableField(unsigned Elt) const {
if (DbgNode == 0)
return 0;
- if (Elt < DbgNode->getNumElements())
- return dyn_cast_or_null<GlobalVariable>(DbgNode->getElement(Elt));
+ if (Elt < DbgNode->getNumOperands())
+ return dyn_cast_or_null<GlobalVariable>(DbgNode->getOperand(Elt));
return 0;
}
+unsigned DIVariable::getNumAddrElements() const {
+ return DbgNode->getNumOperands()-6;
+}
+
+
//===----------------------------------------------------------------------===//
// Predicates
//===----------------------------------------------------------------------===//
@@ -127,18 +132,14 @@ GlobalVariable *DIDescriptor::getGlobalVariableField(unsigned Elt) const {
/// isBasicType - Return true if the specified tag is legal for
/// DIBasicType.
bool DIDescriptor::isBasicType() const {
- assert (!isNull() && "Invalid descriptor!");
- unsigned Tag = getTag();
-
- return Tag == dwarf::DW_TAG_base_type;
+ assert(!isNull() && "Invalid descriptor!");
+ return getTag() == dwarf::DW_TAG_base_type;
}
/// isDerivedType - Return true if the specified tag is legal for DIDerivedType.
bool DIDescriptor::isDerivedType() const {
- assert (!isNull() && "Invalid descriptor!");
- unsigned Tag = getTag();
-
- switch (Tag) {
+ assert(!isNull() && "Invalid descriptor!");
+ switch (getTag()) {
case dwarf::DW_TAG_typedef:
case dwarf::DW_TAG_pointer_type:
case dwarf::DW_TAG_reference_type:
@@ -157,10 +158,8 @@ bool DIDescriptor::isDerivedType() const {
/// isCompositeType - Return true if the specified tag is legal for
/// DICompositeType.
bool DIDescriptor::isCompositeType() const {
- assert (!isNull() && "Invalid descriptor!");
- unsigned Tag = getTag();
-
- switch (Tag) {
+ assert(!isNull() && "Invalid descriptor!");
+ switch (getTag()) {
case dwarf::DW_TAG_array_type:
case dwarf::DW_TAG_structure_type:
case dwarf::DW_TAG_union_type:
@@ -176,10 +175,8 @@ bool DIDescriptor::isCompositeType() const {
/// isVariable - Return true if the specified tag is legal for DIVariable.
bool DIDescriptor::isVariable() const {
- assert (!isNull() && "Invalid descriptor!");
- unsigned Tag = getTag();
-
- switch (Tag) {
+ assert(!isNull() && "Invalid descriptor!");
+ switch (getTag()) {
case dwarf::DW_TAG_auto_variable:
case dwarf::DW_TAG_arg_variable:
case dwarf::DW_TAG_return_variable:
@@ -197,19 +194,15 @@ bool DIDescriptor::isType() const {
/// isSubprogram - Return true if the specified tag is legal for
/// DISubprogram.
bool DIDescriptor::isSubprogram() const {
- assert (!isNull() && "Invalid descriptor!");
- unsigned Tag = getTag();
-
- return Tag == dwarf::DW_TAG_subprogram;
+ assert(!isNull() && "Invalid descriptor!");
+ return getTag() == dwarf::DW_TAG_subprogram;
}
/// isGlobalVariable - Return true if the specified tag is legal for
/// DIGlobalVariable.
bool DIDescriptor::isGlobalVariable() const {
- assert (!isNull() && "Invalid descriptor!");
- unsigned Tag = getTag();
-
- return Tag == dwarf::DW_TAG_variable;
+ assert(!isNull() && "Invalid descriptor!");
+ return getTag() == dwarf::DW_TAG_variable;
}
/// isGlobal - Return true if the specified tag is legal for DIGlobal.
@@ -220,50 +213,47 @@ bool DIDescriptor::isGlobal() const {
/// isScope - Return true if the specified tag is one of the scope
/// related tag.
bool DIDescriptor::isScope() const {
- assert (!isNull() && "Invalid descriptor!");
- unsigned Tag = getTag();
-
- switch (Tag) {
- case dwarf::DW_TAG_compile_unit:
- case dwarf::DW_TAG_lexical_block:
- case dwarf::DW_TAG_subprogram:
- return true;
- default:
- break;
+ assert(!isNull() && "Invalid descriptor!");
+ switch (getTag()) {
+ case dwarf::DW_TAG_compile_unit:
+ case dwarf::DW_TAG_lexical_block:
+ case dwarf::DW_TAG_subprogram:
+ case dwarf::DW_TAG_namespace:
+ return true;
+ default:
+ break;
}
return false;
}
/// isCompileUnit - Return true if the specified tag is DW_TAG_compile_unit.
bool DIDescriptor::isCompileUnit() const {
- assert (!isNull() && "Invalid descriptor!");
- unsigned Tag = getTag();
+ assert(!isNull() && "Invalid descriptor!");
+ return getTag() == dwarf::DW_TAG_compile_unit;
+}
- return Tag == dwarf::DW_TAG_compile_unit;
+/// isNameSpace - Return true if the specified tag is DW_TAG_namespace.
+bool DIDescriptor::isNameSpace() const {
+ assert(!isNull() && "Invalid descriptor!");
+ return getTag() == dwarf::DW_TAG_namespace;
}
/// isLexicalBlock - Return true if the specified tag is DW_TAG_lexical_block.
bool DIDescriptor::isLexicalBlock() const {
- assert (!isNull() && "Invalid descriptor!");
- unsigned Tag = getTag();
-
- return Tag == dwarf::DW_TAG_lexical_block;
+ assert(!isNull() && "Invalid descriptor!");
+ return getTag() == dwarf::DW_TAG_lexical_block;
}
/// isSubrange - Return true if the specified tag is DW_TAG_subrange_type.
bool DIDescriptor::isSubrange() const {
- assert (!isNull() && "Invalid descriptor!");
- unsigned Tag = getTag();
-
- return Tag == dwarf::DW_TAG_subrange_type;
+ assert(!isNull() && "Invalid descriptor!");
+ return getTag() == dwarf::DW_TAG_subrange_type;
}
/// isEnumerator - Return true if the specified tag is DW_TAG_enumerator.
bool DIDescriptor::isEnumerator() const {
- assert (!isNull() && "Invalid descriptor!");
- unsigned Tag = getTag();
-
- return Tag == dwarf::DW_TAG_enumerator;
+ assert(!isNull() && "Invalid descriptor!");
+ return getTag() == dwarf::DW_TAG_enumerator;
}
//===----------------------------------------------------------------------===//
@@ -278,8 +268,8 @@ DIType::DIType(MDNode *N) : DIDescriptor(N) {
}
unsigned DIArray::getNumElements() const {
- assert (DbgNode && "Invalid DIArray");
- return DbgNode->getNumElements();
+ assert(DbgNode && "Invalid DIArray");
+ return DbgNode->getNumOperands();
}
/// replaceAllUsesWith - Replace all uses of debug info referenced by
@@ -289,7 +279,7 @@ void DIDerivedType::replaceAllUsesWith(DIDescriptor &D) {
if (isNull())
return;
- assert (!D.isNull() && "Can not replace with null");
+ assert(!D.isNull() && "Can not replace with null");
// Since we use a TrackingVH for the node, its easy for clients to manufacture
// legitimate situations where they want to replaceAllUsesWith() on something
@@ -299,7 +289,7 @@ void DIDerivedType::replaceAllUsesWith(DIDescriptor &D) {
if (getNode() != D.getNode()) {
MDNode *Node = DbgNode;
Node->replaceAllUsesWith(D.getNode());
- delete Node;
+ Node->destroy();
}
}
@@ -422,7 +412,7 @@ uint64_t DIDerivedType::getOriginalTypeSize() const {
/// describes - Return true if this subprogram provides debugging
/// information for the function F.
bool DISubprogram::describes(const Function *F) {
- assert (F && "Invalid function");
+ assert(F && "Invalid function");
StringRef Name = getLinkageName();
if (Name.empty())
Name = getName();
@@ -434,24 +424,26 @@ bool DISubprogram::describes(const Function *F) {
StringRef DIScope::getFilename() const {
if (isLexicalBlock())
return DILexicalBlock(DbgNode).getFilename();
- else if (isSubprogram())
+ if (isSubprogram())
return DISubprogram(DbgNode).getFilename();
- else if (isCompileUnit())
+ if (isCompileUnit())
return DICompileUnit(DbgNode).getFilename();
- else
- assert (0 && "Invalid DIScope!");
+ if (isNameSpace())
+ return DINameSpace(DbgNode).getFilename();
+ assert(0 && "Invalid DIScope!");
return StringRef();
}
StringRef DIScope::getDirectory() const {
if (isLexicalBlock())
return DILexicalBlock(DbgNode).getDirectory();
- else if (isSubprogram())
+ if (isSubprogram())
return DISubprogram(DbgNode).getDirectory();
- else if (isCompileUnit())
+ if (isCompileUnit())
return DICompileUnit(DbgNode).getDirectory();
- else
- assert (0 && "Invalid DIScope!");
+ if (isNameSpace())
+ return DINameSpace(DbgNode).getDirectory();
+ assert(0 && "Invalid DIScope!");
return StringRef();
}
@@ -462,16 +454,16 @@ StringRef DIScope::getDirectory() const {
/// dump - Print descriptor.
void DIDescriptor::dump() const {
- errs() << "[" << dwarf::TagString(getTag()) << "] ";
- errs().write_hex((intptr_t) &*DbgNode) << ']';
+ dbgs() << "[" << dwarf::TagString(getTag()) << "] ";
+ dbgs().write_hex((intptr_t) &*DbgNode) << ']';
}
/// dump - Print compile unit.
void DICompileUnit::dump() const {
if (getLanguage())
- errs() << " [" << dwarf::LanguageString(getLanguage()) << "] ";
+ dbgs() << " [" << dwarf::LanguageString(getLanguage()) << "] ";
- errs() << " [" << getDirectory() << "/" << getFilename() << " ]";
+ dbgs() << " [" << getDirectory() << "/" << getFilename() << " ]";
}
/// dump - Print type.
@@ -480,14 +472,14 @@ void DIType::dump() const {
StringRef Res = getName();
if (!Res.empty())
- errs() << " [" << Res << "] ";
+ dbgs() << " [" << Res << "] ";
unsigned Tag = getTag();
- errs() << " [" << dwarf::TagString(Tag) << "] ";
+ dbgs() << " [" << dwarf::TagString(Tag) << "] ";
// TODO : Print context
getCompileUnit().dump();
- errs() << " ["
+ dbgs() << " ["
<< getLineNumber() << ", "
<< getSizeInBits() << ", "
<< getAlignInBits() << ", "
@@ -495,12 +487,12 @@ void DIType::dump() const {
<< "] ";
if (isPrivate())
- errs() << " [private] ";
+ dbgs() << " [private] ";
else if (isProtected())
- errs() << " [protected] ";
+ dbgs() << " [protected] ";
if (isForwardDecl())
- errs() << " [fwd] ";
+ dbgs() << " [fwd] ";
if (isBasicType())
DIBasicType(DbgNode).dump();
@@ -509,21 +501,21 @@ void DIType::dump() const {
else if (isCompositeType())
DICompositeType(DbgNode).dump();
else {
- errs() << "Invalid DIType\n";
+ dbgs() << "Invalid DIType\n";
return;
}
- errs() << "\n";
+ dbgs() << "\n";
}
/// dump - Print basic type.
void DIBasicType::dump() const {
- errs() << " [" << dwarf::AttributeEncodingString(getEncoding()) << "] ";
+ dbgs() << " [" << dwarf::AttributeEncodingString(getEncoding()) << "] ";
}
/// dump - Print derived type.
void DIDerivedType::dump() const {
- errs() << "\n\t Derived From: "; getTypeDerivedFrom().dump();
+ dbgs() << "\n\t Derived From: "; getTypeDerivedFrom().dump();
}
/// dump - Print composite type.
@@ -531,73 +523,73 @@ void DICompositeType::dump() const {
DIArray A = getTypeArray();
if (A.isNull())
return;
- errs() << " [" << A.getNumElements() << " elements]";
+ dbgs() << " [" << A.getNumElements() << " elements]";
}
/// dump - Print global.
void DIGlobal::dump() const {
StringRef Res = getName();
if (!Res.empty())
- errs() << " [" << Res << "] ";
+ dbgs() << " [" << Res << "] ";
unsigned Tag = getTag();
- errs() << " [" << dwarf::TagString(Tag) << "] ";
+ dbgs() << " [" << dwarf::TagString(Tag) << "] ";
// TODO : Print context
getCompileUnit().dump();
- errs() << " [" << getLineNumber() << "] ";
+ dbgs() << " [" << getLineNumber() << "] ";
if (isLocalToUnit())
- errs() << " [local] ";
+ dbgs() << " [local] ";
if (isDefinition())
- errs() << " [def] ";
+ dbgs() << " [def] ";
if (isGlobalVariable())
DIGlobalVariable(DbgNode).dump();
- errs() << "\n";
+ dbgs() << "\n";
}
/// dump - Print subprogram.
void DISubprogram::dump() const {
StringRef Res = getName();
if (!Res.empty())
- errs() << " [" << Res << "] ";
+ dbgs() << " [" << Res << "] ";
unsigned Tag = getTag();
- errs() << " [" << dwarf::TagString(Tag) << "] ";
+ dbgs() << " [" << dwarf::TagString(Tag) << "] ";
// TODO : Print context
getCompileUnit().dump();
- errs() << " [" << getLineNumber() << "] ";
+ dbgs() << " [" << getLineNumber() << "] ";
if (isLocalToUnit())
- errs() << " [local] ";
+ dbgs() << " [local] ";
if (isDefinition())
- errs() << " [def] ";
+ dbgs() << " [def] ";
- errs() << "\n";
+ dbgs() << "\n";
}
/// dump - Print global variable.
void DIGlobalVariable::dump() const {
- errs() << " [";
+ dbgs() << " [";
getGlobal()->dump();
- errs() << "] ";
+ dbgs() << "] ";
}
/// dump - Print variable.
void DIVariable::dump() const {
StringRef Res = getName();
if (!Res.empty())
- errs() << " [" << Res << "] ";
+ dbgs() << " [" << Res << "] ";
getCompileUnit().dump();
- errs() << " [" << getLineNumber() << "] ";
+ dbgs() << " [" << getLineNumber() << "] ";
getType().dump();
- errs() << "\n";
+ dbgs() << "\n";
// FIXME: Dump complex addresses
}
@@ -899,18 +891,18 @@ DISubprogram DIFactory::CreateSubprogramDefinition(DISubprogram &SPDeclaration)
Value *Elts[] = {
GetTagConstant(dwarf::DW_TAG_subprogram),
llvm::Constant::getNullValue(Type::getInt32Ty(VMContext)),
- DeclNode->getElement(2), // Context
- DeclNode->getElement(3), // Name
- DeclNode->getElement(4), // DisplayName
- DeclNode->getElement(5), // LinkageName
- DeclNode->getElement(6), // CompileUnit
- DeclNode->getElement(7), // LineNo
- DeclNode->getElement(8), // Type
- DeclNode->getElement(9), // isLocalToUnit
+ DeclNode->getOperand(2), // Context
+ DeclNode->getOperand(3), // Name
+ DeclNode->getOperand(4), // DisplayName
+ DeclNode->getOperand(5), // LinkageName
+ DeclNode->getOperand(6), // CompileUnit
+ DeclNode->getOperand(7), // LineNo
+ DeclNode->getOperand(8), // Type
+ DeclNode->getOperand(9), // isLocalToUnit
ConstantInt::get(Type::getInt1Ty(VMContext), true),
- DeclNode->getElement(11), // Virtuality
- DeclNode->getElement(12), // VIndex
- DeclNode->getElement(13) // Containting Type
+ DeclNode->getOperand(11), // Virtuality
+ DeclNode->getOperand(12), // VIndex
+ DeclNode->getOperand(13) // Containting Type
};
return DISubprogram(MDNode::get(VMContext, &Elts[0], 14));
}
@@ -943,7 +935,7 @@ DIFactory::CreateGlobalVariable(DIDescriptor Context, StringRef Name,
// Create a named metadata so that we do not lose this mdnode.
NamedMDNode *NMD = M.getOrInsertNamedMetadata("llvm.dbg.gv");
- NMD->addElement(Node);
+ NMD->addOperand(Node);
return DIGlobalVariable(Node);
}
@@ -996,6 +988,21 @@ DILexicalBlock DIFactory::CreateLexicalBlock(DIDescriptor Context) {
return DILexicalBlock(MDNode::get(VMContext, &Elts[0], 2));
}
+/// CreateNameSpace - This creates new descriptor for a namespace
+/// with the specified parent context.
+DINameSpace DIFactory::CreateNameSpace(DIDescriptor Context, StringRef Name,
+ DICompileUnit CompileUnit,
+ unsigned LineNo) {
+ Value *Elts[] = {
+ GetTagConstant(dwarf::DW_TAG_namespace),
+ Context.getNode(),
+ MDString::get(VMContext, Name),
+ CompileUnit.getNode(),
+ ConstantInt::get(Type::getInt32Ty(VMContext), LineNo)
+ };
+ return DINameSpace(MDNode::get(VMContext, &Elts[0], 5));
+}
+
/// CreateLocation - Creates a debug info location.
DILocation DIFactory::CreateLocation(unsigned LineNo, unsigned ColumnNo,
DIScope S, DILocation OrigLoc) {
@@ -1088,9 +1095,7 @@ Instruction *DIFactory::InsertDbgValueIntrinsic(Value *V, Value *Offset,
/// processModule - Process entire module and collect debug info.
void DebugInfoFinder::processModule(Module &M) {
-
- MetadataContext &TheMetadata = M.getContext().getMetadata();
- unsigned MDDbgKind = TheMetadata.getMDKind("dbg");
+ unsigned MDDbgKind = M.getMDKindID("dbg");
for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I)
for (Function::iterator FI = (*I).begin(), FE = (*I).end(); FI != FE; ++FI)
@@ -1098,17 +1103,16 @@ void DebugInfoFinder::processModule(Module &M) {
++BI) {
if (DbgDeclareInst *DDI = dyn_cast<DbgDeclareInst>(BI))
processDeclare(DDI);
- else if (MDDbgKind)
- if (MDNode *L = TheMetadata.getMD(MDDbgKind, BI))
- processLocation(DILocation(L));
+ else if (MDNode *L = BI->getMetadata(MDDbgKind))
+ processLocation(DILocation(L));
}
NamedMDNode *NMD = M.getNamedMetadata("llvm.dbg.gv");
if (!NMD)
return;
- for (unsigned i = 0, e = NMD->getNumElements(); i != e; ++i) {
- DIGlobalVariable DIG(cast<MDNode>(NMD->getElement(i)));
+ for (unsigned i = 0, e = NMD->getNumOperands(); i != e; ++i) {
+ DIGlobalVariable DIG(cast<MDNode>(NMD->getOperand(i)));
if (addGlobalVariable(DIG)) {
addCompileUnit(DIG.getCompileUnit());
processType(DIG.getType());
@@ -1238,275 +1242,237 @@ bool DebugInfoFinder::addSubprogram(DISubprogram SP) {
return true;
}
-namespace llvm {
- /// findStopPoint - Find the stoppoint coressponding to this instruction, that
- /// is the stoppoint that dominates this instruction.
- const DbgStopPointInst *findStopPoint(const Instruction *Inst) {
- if (const DbgStopPointInst *DSI = dyn_cast<DbgStopPointInst>(Inst))
- return DSI;
-
- const BasicBlock *BB = Inst->getParent();
- BasicBlock::const_iterator I = Inst, B;
- while (BB) {
- B = BB->begin();
-
- // A BB consisting only of a terminator can't have a stoppoint.
- while (I != B) {
- --I;
- if (const DbgStopPointInst *DSI = dyn_cast<DbgStopPointInst>(I))
- return DSI;
- }
-
- // This BB didn't have a stoppoint: if there is only one predecessor, look
- // for a stoppoint there. We could use getIDom(), but that would require
- // dominator info.
- BB = I->getParent()->getUniquePredecessor();
- if (BB)
- I = BB->getTerminator();
- }
+/// findStopPoint - Find the stoppoint coressponding to this instruction, that
+/// is the stoppoint that dominates this instruction.
+const DbgStopPointInst *llvm::findStopPoint(const Instruction *Inst) {
+ if (const DbgStopPointInst *DSI = dyn_cast<DbgStopPointInst>(Inst))
+ return DSI;
- return 0;
- }
+ const BasicBlock *BB = Inst->getParent();
+ BasicBlock::const_iterator I = Inst, B;
+ while (BB) {
+ B = BB->begin();
- /// findBBStopPoint - Find the stoppoint corresponding to first real
- /// (non-debug intrinsic) instruction in this Basic Block, and return the
- /// stoppoint for it.
- const DbgStopPointInst *findBBStopPoint(const BasicBlock *BB) {
- for(BasicBlock::const_iterator I = BB->begin(), E = BB->end(); I != E; ++I)
+ // A BB consisting only of a terminator can't have a stoppoint.
+ while (I != B) {
+ --I;
if (const DbgStopPointInst *DSI = dyn_cast<DbgStopPointInst>(I))
return DSI;
+ }
- // Fallback to looking for stoppoint of unique predecessor. Useful if this
- // BB contains no stoppoints, but unique predecessor does.
- BB = BB->getUniquePredecessor();
+ // This BB didn't have a stoppoint: if there is only one predecessor, look
+ // for a stoppoint there. We could use getIDom(), but that would require
+ // dominator info.
+ BB = I->getParent()->getUniquePredecessor();
if (BB)
- return findStopPoint(BB->getTerminator());
-
- return 0;
+ I = BB->getTerminator();
}
- Value *findDbgGlobalDeclare(GlobalVariable *V) {
- const Module *M = V->getParent();
- NamedMDNode *NMD = M->getNamedMetadata("llvm.dbg.gv");
- if (!NMD)
- return 0;
-
- for (unsigned i = 0, e = NMD->getNumElements(); i != e; ++i) {
- DIGlobalVariable DIG(cast_or_null<MDNode>(NMD->getElement(i)));
- if (DIG.isNull())
- continue;
- if (DIG.getGlobal() == V)
- return DIG.getNode();
- }
- return 0;
- }
-
- /// Finds the llvm.dbg.declare intrinsic corresponding to this value if any.
- /// It looks through pointer casts too.
- const DbgDeclareInst *findDbgDeclare(const Value *V, bool stripCasts) {
- if (stripCasts) {
- V = V->stripPointerCasts();
-
- // Look for the bitcast.
- for (Value::use_const_iterator I = V->use_begin(), E =V->use_end();
- I != E; ++I)
- if (isa<BitCastInst>(I)) {
- const DbgDeclareInst *DDI = findDbgDeclare(*I, false);
- if (DDI) return DDI;
- }
- return 0;
- }
+ return 0;
+}
- // Find llvm.dbg.declare among uses of the instruction.
- for (Value::use_const_iterator I = V->use_begin(), E =V->use_end();
- I != E; ++I)
- if (const DbgDeclareInst *DDI = dyn_cast<DbgDeclareInst>(I))
- return DDI;
+/// findBBStopPoint - Find the stoppoint corresponding to first real
+/// (non-debug intrinsic) instruction in this Basic Block, and return the
+/// stoppoint for it.
+const DbgStopPointInst *llvm::findBBStopPoint(const BasicBlock *BB) {
+ for(BasicBlock::const_iterator I = BB->begin(), E = BB->end(); I != E; ++I)
+ if (const DbgStopPointInst *DSI = dyn_cast<DbgStopPointInst>(I))
+ return DSI;
- return 0;
- }
+ // Fallback to looking for stoppoint of unique predecessor. Useful if this
+ // BB contains no stoppoints, but unique predecessor does.
+ BB = BB->getUniquePredecessor();
+ if (BB)
+ return findStopPoint(BB->getTerminator());
-bool getLocationInfo(const Value *V, std::string &DisplayName,
- std::string &Type, unsigned &LineNo, std::string &File,
- std::string &Dir) {
- DICompileUnit Unit;
- DIType TypeD;
-
- if (GlobalVariable *GV = dyn_cast<GlobalVariable>(const_cast<Value*>(V))) {
- Value *DIGV = findDbgGlobalDeclare(GV);
- if (!DIGV) return false;
- DIGlobalVariable Var(cast<MDNode>(DIGV));
-
- StringRef D = Var.getDisplayName();
- if (!D.empty())
- DisplayName = D;
- LineNo = Var.getLineNumber();
- Unit = Var.getCompileUnit();
- TypeD = Var.getType();
- } else {
- const DbgDeclareInst *DDI = findDbgDeclare(V);
- if (!DDI) return false;
- DIVariable Var(cast<MDNode>(DDI->getVariable()));
-
- StringRef D = Var.getName();
- if (!D.empty())
- DisplayName = D;
- LineNo = Var.getLineNumber();
- Unit = Var.getCompileUnit();
- TypeD = Var.getType();
- }
+ return 0;
+}
- StringRef T = TypeD.getName();
- if (!T.empty())
- Type = T;
- StringRef F = Unit.getFilename();
- if (!F.empty())
- File = F;
- StringRef D = Unit.getDirectory();
- if (!D.empty())
- Dir = D;
- return true;
- }
+Value *llvm::findDbgGlobalDeclare(GlobalVariable *V) {
+ const Module *M = V->getParent();
+ NamedMDNode *NMD = M->getNamedMetadata("llvm.dbg.gv");
+ if (!NMD)
+ return 0;
- /// isValidDebugInfoIntrinsic - Return true if SPI is a valid debug
- /// info intrinsic.
- bool isValidDebugInfoIntrinsic(DbgStopPointInst &SPI,
- CodeGenOpt::Level OptLev) {
- return DIDescriptor::ValidDebugInfo(SPI.getContext(), OptLev);
+ for (unsigned i = 0, e = NMD->getNumOperands(); i != e; ++i) {
+ DIGlobalVariable DIG(cast_or_null<MDNode>(NMD->getOperand(i)));
+ if (DIG.isNull())
+ continue;
+ if (DIG.getGlobal() == V)
+ return DIG.getNode();
}
+ return 0;
+}
- /// isValidDebugInfoIntrinsic - Return true if FSI is a valid debug
- /// info intrinsic.
- bool isValidDebugInfoIntrinsic(DbgFuncStartInst &FSI,
- CodeGenOpt::Level OptLev) {
- return DIDescriptor::ValidDebugInfo(FSI.getSubprogram(), OptLev);
- }
+/// Finds the llvm.dbg.declare intrinsic corresponding to this value if any.
+/// It looks through pointer casts too.
+const DbgDeclareInst *llvm::findDbgDeclare(const Value *V, bool stripCasts) {
+ if (stripCasts) {
+ V = V->stripPointerCasts();
- /// isValidDebugInfoIntrinsic - Return true if RSI is a valid debug
- /// info intrinsic.
- bool isValidDebugInfoIntrinsic(DbgRegionStartInst &RSI,
- CodeGenOpt::Level OptLev) {
- return DIDescriptor::ValidDebugInfo(RSI.getContext(), OptLev);
+ // Look for the bitcast.
+ for (Value::use_const_iterator I = V->use_begin(), E =V->use_end();
+ I != E; ++I)
+ if (isa<BitCastInst>(I)) {
+ const DbgDeclareInst *DDI = findDbgDeclare(*I, false);
+ if (DDI) return DDI;
+ }
+ return 0;
}
- /// isValidDebugInfoIntrinsic - Return true if REI is a valid debug
- /// info intrinsic.
- bool isValidDebugInfoIntrinsic(DbgRegionEndInst &REI,
- CodeGenOpt::Level OptLev) {
- return DIDescriptor::ValidDebugInfo(REI.getContext(), OptLev);
- }
+ // Find llvm.dbg.declare among uses of the instruction.
+ for (Value::use_const_iterator I = V->use_begin(), E =V->use_end();
+ I != E; ++I)
+ if (const DbgDeclareInst *DDI = dyn_cast<DbgDeclareInst>(I))
+ return DDI;
+ return 0;
+}
- /// isValidDebugInfoIntrinsic - Return true if DI is a valid debug
- /// info intrinsic.
- bool isValidDebugInfoIntrinsic(DbgDeclareInst &DI,
- CodeGenOpt::Level OptLev) {
- return DIDescriptor::ValidDebugInfo(DI.getVariable(), OptLev);
- }
+bool llvm::getLocationInfo(const Value *V, std::string &DisplayName,
+ std::string &Type, unsigned &LineNo,
+ std::string &File, std::string &Dir) {
+ DICompileUnit Unit;
+ DIType TypeD;
- /// ExtractDebugLocation - Extract debug location information
- /// from llvm.dbg.stoppoint intrinsic.
- DebugLoc ExtractDebugLocation(DbgStopPointInst &SPI,
- DebugLocTracker &DebugLocInfo) {
- DebugLoc DL;
- Value *Context = SPI.getContext();
-
- // If this location is already tracked then use it.
- DebugLocTuple Tuple(cast<MDNode>(Context), NULL, SPI.getLine(),
- SPI.getColumn());
- DenseMap<DebugLocTuple, unsigned>::iterator II
- = DebugLocInfo.DebugIdMap.find(Tuple);
- if (II != DebugLocInfo.DebugIdMap.end())
- return DebugLoc::get(II->second);
-
- // Add a new location entry.
- unsigned Id = DebugLocInfo.DebugLocations.size();
- DebugLocInfo.DebugLocations.push_back(Tuple);
- DebugLocInfo.DebugIdMap[Tuple] = Id;
-
- return DebugLoc::get(Id);
- }
+ if (GlobalVariable *GV = dyn_cast<GlobalVariable>(const_cast<Value*>(V))) {
+ Value *DIGV = findDbgGlobalDeclare(GV);
+ if (!DIGV) return false;
+ DIGlobalVariable Var(cast<MDNode>(DIGV));
- /// ExtractDebugLocation - Extract debug location information
- /// from DILocation.
- DebugLoc ExtractDebugLocation(DILocation &Loc,
- DebugLocTracker &DebugLocInfo) {
- DebugLoc DL;
- MDNode *Context = Loc.getScope().getNode();
- MDNode *InlinedLoc = NULL;
- if (!Loc.getOrigLocation().isNull())
- InlinedLoc = Loc.getOrigLocation().getNode();
- // If this location is already tracked then use it.
- DebugLocTuple Tuple(Context, InlinedLoc, Loc.getLineNumber(),
- Loc.getColumnNumber());
- DenseMap<DebugLocTuple, unsigned>::iterator II
- = DebugLocInfo.DebugIdMap.find(Tuple);
- if (II != DebugLocInfo.DebugIdMap.end())
- return DebugLoc::get(II->second);
-
- // Add a new location entry.
- unsigned Id = DebugLocInfo.DebugLocations.size();
- DebugLocInfo.DebugLocations.push_back(Tuple);
- DebugLocInfo.DebugIdMap[Tuple] = Id;
-
- return DebugLoc::get(Id);
+ StringRef D = Var.getDisplayName();
+ if (!D.empty())
+ DisplayName = D;
+ LineNo = Var.getLineNumber();
+ Unit = Var.getCompileUnit();
+ TypeD = Var.getType();
+ } else {
+ const DbgDeclareInst *DDI = findDbgDeclare(V);
+ if (!DDI) return false;
+ DIVariable Var(cast<MDNode>(DDI->getVariable()));
+
+ StringRef D = Var.getName();
+ if (!D.empty())
+ DisplayName = D;
+ LineNo = Var.getLineNumber();
+ Unit = Var.getCompileUnit();
+ TypeD = Var.getType();
}
- /// ExtractDebugLocation - Extract debug location information
- /// from llvm.dbg.func_start intrinsic.
- DebugLoc ExtractDebugLocation(DbgFuncStartInst &FSI,
- DebugLocTracker &DebugLocInfo) {
- DebugLoc DL;
- Value *SP = FSI.getSubprogram();
-
- DISubprogram Subprogram(cast<MDNode>(SP));
- unsigned Line = Subprogram.getLineNumber();
- DICompileUnit CU(Subprogram.getCompileUnit());
-
- // If this location is already tracked then use it.
- DebugLocTuple Tuple(CU.getNode(), NULL, Line, /* Column */ 0);
- DenseMap<DebugLocTuple, unsigned>::iterator II
- = DebugLocInfo.DebugIdMap.find(Tuple);
- if (II != DebugLocInfo.DebugIdMap.end())
- return DebugLoc::get(II->second);
-
- // Add a new location entry.
- unsigned Id = DebugLocInfo.DebugLocations.size();
- DebugLocInfo.DebugLocations.push_back(Tuple);
- DebugLocInfo.DebugIdMap[Tuple] = Id;
-
- return DebugLoc::get(Id);
- }
+ StringRef T = TypeD.getName();
+ if (!T.empty())
+ Type = T;
+ StringRef F = Unit.getFilename();
+ if (!F.empty())
+ File = F;
+ StringRef D = Unit.getDirectory();
+ if (!D.empty())
+ Dir = D;
+ return true;
+}
- /// getDISubprogram - Find subprogram that is enclosing this scope.
- DISubprogram getDISubprogram(MDNode *Scope) {
- DIDescriptor D(Scope);
- if (D.isNull())
- return DISubprogram();
-
- if (D.isCompileUnit())
- return DISubprogram();
-
- if (D.isSubprogram())
- return DISubprogram(Scope);
-
- if (D.isLexicalBlock())
- return getDISubprogram(DILexicalBlock(Scope).getContext().getNode());
-
+/// ExtractDebugLocation - Extract debug location information
+/// from llvm.dbg.stoppoint intrinsic.
+DebugLoc llvm::ExtractDebugLocation(DbgStopPointInst &SPI,
+ DebugLocTracker &DebugLocInfo) {
+ DebugLoc DL;
+ Value *Context = SPI.getContext();
+
+ // If this location is already tracked then use it.
+ DebugLocTuple Tuple(cast<MDNode>(Context), NULL, SPI.getLine(),
+ SPI.getColumn());
+ DenseMap<DebugLocTuple, unsigned>::iterator II
+ = DebugLocInfo.DebugIdMap.find(Tuple);
+ if (II != DebugLocInfo.DebugIdMap.end())
+ return DebugLoc::get(II->second);
+
+ // Add a new location entry.
+ unsigned Id = DebugLocInfo.DebugLocations.size();
+ DebugLocInfo.DebugLocations.push_back(Tuple);
+ DebugLocInfo.DebugIdMap[Tuple] = Id;
+
+ return DebugLoc::get(Id);
+}
+
+/// ExtractDebugLocation - Extract debug location information
+/// from DILocation.
+DebugLoc llvm::ExtractDebugLocation(DILocation &Loc,
+ DebugLocTracker &DebugLocInfo) {
+ DebugLoc DL;
+ MDNode *Context = Loc.getScope().getNode();
+ MDNode *InlinedLoc = NULL;
+ if (!Loc.getOrigLocation().isNull())
+ InlinedLoc = Loc.getOrigLocation().getNode();
+ // If this location is already tracked then use it.
+ DebugLocTuple Tuple(Context, InlinedLoc, Loc.getLineNumber(),
+ Loc.getColumnNumber());
+ DenseMap<DebugLocTuple, unsigned>::iterator II
+ = DebugLocInfo.DebugIdMap.find(Tuple);
+ if (II != DebugLocInfo.DebugIdMap.end())
+ return DebugLoc::get(II->second);
+
+ // Add a new location entry.
+ unsigned Id = DebugLocInfo.DebugLocations.size();
+ DebugLocInfo.DebugLocations.push_back(Tuple);
+ DebugLocInfo.DebugIdMap[Tuple] = Id;
+
+ return DebugLoc::get(Id);
+}
+
+/// ExtractDebugLocation - Extract debug location information
+/// from llvm.dbg.func_start intrinsic.
+DebugLoc llvm::ExtractDebugLocation(DbgFuncStartInst &FSI,
+ DebugLocTracker &DebugLocInfo) {
+ DebugLoc DL;
+ Value *SP = FSI.getSubprogram();
+
+ DISubprogram Subprogram(cast<MDNode>(SP));
+ unsigned Line = Subprogram.getLineNumber();
+ DICompileUnit CU(Subprogram.getCompileUnit());
+
+ // If this location is already tracked then use it.
+ DebugLocTuple Tuple(CU.getNode(), NULL, Line, /* Column */ 0);
+ DenseMap<DebugLocTuple, unsigned>::iterator II
+ = DebugLocInfo.DebugIdMap.find(Tuple);
+ if (II != DebugLocInfo.DebugIdMap.end())
+ return DebugLoc::get(II->second);
+
+ // Add a new location entry.
+ unsigned Id = DebugLocInfo.DebugLocations.size();
+ DebugLocInfo.DebugLocations.push_back(Tuple);
+ DebugLocInfo.DebugIdMap[Tuple] = Id;
+
+ return DebugLoc::get(Id);
+}
+
+/// getDISubprogram - Find subprogram that is enclosing this scope.
+DISubprogram llvm::getDISubprogram(MDNode *Scope) {
+ DIDescriptor D(Scope);
+ if (D.isNull())
return DISubprogram();
- }
-
- /// getDICompositeType - Find underlying composite type.
- DICompositeType getDICompositeType(DIType T) {
- if (T.isNull())
- return DICompositeType();
-
- if (T.isCompositeType())
- return DICompositeType(T.getNode());
-
- if (T.isDerivedType())
- return getDICompositeType(DIDerivedType(T.getNode()).getTypeDerivedFrom());
-
+
+ if (D.isCompileUnit())
+ return DISubprogram();
+
+ if (D.isSubprogram())
+ return DISubprogram(Scope);
+
+ if (D.isLexicalBlock())
+ return getDISubprogram(DILexicalBlock(Scope).getContext().getNode());
+
+ return DISubprogram();
+}
+
+/// getDICompositeType - Find underlying composite type.
+DICompositeType llvm::getDICompositeType(DIType T) {
+ if (T.isNull())
return DICompositeType();
- }
+
+ if (T.isCompositeType())
+ return DICompositeType(T.getNode());
+
+ if (T.isDerivedType())
+ return getDICompositeType(DIDerivedType(T.getNode()).getTypeDerivedFrom());
+
+ return DICompositeType();
}
diff --git a/lib/Analysis/IPA/Andersens.cpp b/lib/Analysis/IPA/Andersens.cpp
index 4d5b312..28c66af 100644
--- a/lib/Analysis/IPA/Andersens.cpp
+++ b/lib/Analysis/IPA/Andersens.cpp
@@ -1402,7 +1402,7 @@ void Andersens::ClumpAddressTaken() {
unsigned Pos = NewPos++;
Translate[i] = Pos;
NewGraphNodes.push_back(GraphNodes[i]);
- DEBUG(errs() << "Renumbering node " << i << " to node " << Pos << "\n");
+ DEBUG(dbgs() << "Renumbering node " << i << " to node " << Pos << "\n");
}
// I believe this ends up being faster than making two vectors and splicing
@@ -1412,7 +1412,7 @@ void Andersens::ClumpAddressTaken() {
unsigned Pos = NewPos++;
Translate[i] = Pos;
NewGraphNodes.push_back(GraphNodes[i]);
- DEBUG(errs() << "Renumbering node " << i << " to node " << Pos << "\n");
+ DEBUG(dbgs() << "Renumbering node " << i << " to node " << Pos << "\n");
}
}
@@ -1421,7 +1421,7 @@ void Andersens::ClumpAddressTaken() {
unsigned Pos = NewPos++;
Translate[i] = Pos;
NewGraphNodes.push_back(GraphNodes[i]);
- DEBUG(errs() << "Renumbering node " << i << " to node " << Pos << "\n");
+ DEBUG(dbgs() << "Renumbering node " << i << " to node " << Pos << "\n");
}
}
@@ -1493,7 +1493,7 @@ void Andersens::ClumpAddressTaken() {
/// receive &D from E anyway.
void Andersens::HVN() {
- DEBUG(errs() << "Beginning HVN\n");
+ DEBUG(dbgs() << "Beginning HVN\n");
// Build a predecessor graph. This is like our constraint graph with the
// edges going in the opposite direction, and there are edges for all the
// constraints, instead of just copy constraints. We also build implicit
@@ -1564,7 +1564,7 @@ void Andersens::HVN() {
Node2DFS.clear();
Node2Deleted.clear();
Node2Visited.clear();
- DEBUG(errs() << "Finished HVN\n");
+ DEBUG(dbgs() << "Finished HVN\n");
}
@@ -1688,7 +1688,7 @@ void Andersens::HVNValNum(unsigned NodeIndex) {
/// and is equivalent to value numbering the collapsed constraint graph
/// including evaluating unions.
void Andersens::HU() {
- DEBUG(errs() << "Beginning HU\n");
+ DEBUG(dbgs() << "Beginning HU\n");
// Build a predecessor graph. This is like our constraint graph with the
// edges going in the opposite direction, and there are edges for all the
// constraints, instead of just copy constraints. We also build implicit
@@ -1768,7 +1768,7 @@ void Andersens::HU() {
}
// PEClass nodes will be deleted by the deleting of N->PointsTo in our caller.
Set2PEClass.clear();
- DEBUG(errs() << "Finished HU\n");
+ DEBUG(dbgs() << "Finished HU\n");
}
@@ -1946,12 +1946,12 @@ void Andersens::RewriteConstraints() {
// to anything.
if (LHSLabel == 0) {
DEBUG(PrintNode(&GraphNodes[LHSNode]));
- DEBUG(errs() << " is a non-pointer, ignoring constraint.\n");
+ DEBUG(dbgs() << " is a non-pointer, ignoring constraint.\n");
continue;
}
if (RHSLabel == 0) {
DEBUG(PrintNode(&GraphNodes[RHSNode]));
- DEBUG(errs() << " is a non-pointer, ignoring constraint.\n");
+ DEBUG(dbgs() << " is a non-pointer, ignoring constraint.\n");
continue;
}
// This constraint may be useless, and it may become useless as we translate
@@ -1999,16 +1999,16 @@ void Andersens::PrintLabels() const {
if (i < FirstRefNode) {
PrintNode(&GraphNodes[i]);
} else if (i < FirstAdrNode) {
- DEBUG(errs() << "REF(");
+ DEBUG(dbgs() << "REF(");
PrintNode(&GraphNodes[i-FirstRefNode]);
- DEBUG(errs() <<")");
+ DEBUG(dbgs() <<")");
} else {
- DEBUG(errs() << "ADR(");
+ DEBUG(dbgs() << "ADR(");
PrintNode(&GraphNodes[i-FirstAdrNode]);
- DEBUG(errs() <<")");
+ DEBUG(dbgs() <<")");
}
- DEBUG(errs() << " has pointer label " << GraphNodes[i].PointerEquivLabel
+ DEBUG(dbgs() << " has pointer label " << GraphNodes[i].PointerEquivLabel
<< " and SCC rep " << VSSCCRep[i]
<< " and is " << (GraphNodes[i].Direct ? "Direct" : "Not direct")
<< "\n");
@@ -2025,7 +2025,7 @@ void Andersens::PrintLabels() const {
/// operation are stored in SDT and are later used in SolveContraints()
/// and UniteNodes().
void Andersens::HCD() {
- DEBUG(errs() << "Starting HCD.\n");
+ DEBUG(dbgs() << "Starting HCD.\n");
HCDSCCRep.resize(GraphNodes.size());
for (unsigned i = 0; i < GraphNodes.size(); ++i) {
@@ -2074,7 +2074,7 @@ void Andersens::HCD() {
Node2Visited.clear();
Node2Deleted.clear();
HCDSCCRep.clear();
- DEBUG(errs() << "HCD complete.\n");
+ DEBUG(dbgs() << "HCD complete.\n");
}
// Component of HCD:
@@ -2146,7 +2146,7 @@ void Andersens::Search(unsigned Node) {
/// Optimize the constraints by performing offline variable substitution and
/// other optimizations.
void Andersens::OptimizeConstraints() {
- DEBUG(errs() << "Beginning constraint optimization\n");
+ DEBUG(dbgs() << "Beginning constraint optimization\n");
SDTActive = false;
@@ -2230,7 +2230,7 @@ void Andersens::OptimizeConstraints() {
// HCD complete.
- DEBUG(errs() << "Finished constraint optimization\n");
+ DEBUG(dbgs() << "Finished constraint optimization\n");
FirstRefNode = 0;
FirstAdrNode = 0;
}
@@ -2238,7 +2238,7 @@ void Andersens::OptimizeConstraints() {
/// Unite pointer but not location equivalent variables, now that the constraint
/// graph is built.
void Andersens::UnitePointerEquivalences() {
- DEBUG(errs() << "Uniting remaining pointer equivalences\n");
+ DEBUG(dbgs() << "Uniting remaining pointer equivalences\n");
for (unsigned i = 0; i < GraphNodes.size(); ++i) {
if (GraphNodes[i].AddressTaken && GraphNodes[i].isRep()) {
unsigned Label = GraphNodes[i].PointerEquivLabel;
@@ -2247,7 +2247,7 @@ void Andersens::UnitePointerEquivalences() {
UniteNodes(i, PENLEClass2Node[Label]);
}
}
- DEBUG(errs() << "Finished remaining pointer equivalences\n");
+ DEBUG(dbgs() << "Finished remaining pointer equivalences\n");
PENLEClass2Node.clear();
}
@@ -2403,7 +2403,7 @@ void Andersens::SolveConstraints() {
std::vector<unsigned int> RSV;
#endif
while( !CurrWL->empty() ) {
- DEBUG(errs() << "Starting iteration #" << ++NumIters << "\n");
+ DEBUG(dbgs() << "Starting iteration #" << ++NumIters << "\n");
Node* CurrNode;
unsigned CurrNodeIndex;
@@ -2706,11 +2706,11 @@ unsigned Andersens::UniteNodes(unsigned First, unsigned Second,
SecondNode->OldPointsTo = NULL;
NumUnified++;
- DEBUG(errs() << "Unified Node ");
+ DEBUG(dbgs() << "Unified Node ");
DEBUG(PrintNode(FirstNode));
- DEBUG(errs() << " and Node ");
+ DEBUG(dbgs() << " and Node ");
DEBUG(PrintNode(SecondNode));
- DEBUG(errs() << "\n");
+ DEBUG(dbgs() << "\n");
if (SDTActive)
if (SDT[Second] >= 0) {
@@ -2755,17 +2755,17 @@ unsigned Andersens::FindNode(unsigned NodeIndex) const {
void Andersens::PrintNode(const Node *N) const {
if (N == &GraphNodes[UniversalSet]) {
- errs() << "<universal>";
+ dbgs() << "<universal>";
return;
} else if (N == &GraphNodes[NullPtr]) {
- errs() << "<nullptr>";
+ dbgs() << "<nullptr>";
return;
} else if (N == &GraphNodes[NullObject]) {
- errs() << "<null>";
+ dbgs() << "<null>";
return;
}
if (!N->getValue()) {
- errs() << "artificial" << (intptr_t) N;
+ dbgs() << "artificial" << (intptr_t) N;
return;
}
@@ -2774,85 +2774,85 @@ void Andersens::PrintNode(const Node *N) const {
if (Function *F = dyn_cast<Function>(V)) {
if (isa<PointerType>(F->getFunctionType()->getReturnType()) &&
N == &GraphNodes[getReturnNode(F)]) {
- errs() << F->getName() << ":retval";
+ dbgs() << F->getName() << ":retval";
return;
} else if (F->getFunctionType()->isVarArg() &&
N == &GraphNodes[getVarargNode(F)]) {
- errs() << F->getName() << ":vararg";
+ dbgs() << F->getName() << ":vararg";
return;
}
}
if (Instruction *I = dyn_cast<Instruction>(V))
- errs() << I->getParent()->getParent()->getName() << ":";
+ dbgs() << I->getParent()->getParent()->getName() << ":";
else if (Argument *Arg = dyn_cast<Argument>(V))
- errs() << Arg->getParent()->getName() << ":";
+ dbgs() << Arg->getParent()->getName() << ":";
if (V->hasName())
- errs() << V->getName();
+ dbgs() << V->getName();
else
- errs() << "(unnamed)";
+ dbgs() << "(unnamed)";
if (isa<GlobalValue>(V) || isa<AllocaInst>(V) || isMalloc(V))
if (N == &GraphNodes[getObject(V)])
- errs() << "<mem>";
+ dbgs() << "<mem>";
}
void Andersens::PrintConstraint(const Constraint &C) const {
if (C.Type == Constraint::Store) {
- errs() << "*";
+ dbgs() << "*";
if (C.Offset != 0)
- errs() << "(";
+ dbgs() << "(";
}
PrintNode(&GraphNodes[C.Dest]);
if (C.Type == Constraint::Store && C.Offset != 0)
- errs() << " + " << C.Offset << ")";
- errs() << " = ";
+ dbgs() << " + " << C.Offset << ")";
+ dbgs() << " = ";
if (C.Type == Constraint::Load) {
- errs() << "*";
+ dbgs() << "*";
if (C.Offset != 0)
- errs() << "(";
+ dbgs() << "(";
}
else if (C.Type == Constraint::AddressOf)
- errs() << "&";
+ dbgs() << "&";
PrintNode(&GraphNodes[C.Src]);
if (C.Offset != 0 && C.Type != Constraint::Store)
- errs() << " + " << C.Offset;
+ dbgs() << " + " << C.Offset;
if (C.Type == Constraint::Load && C.Offset != 0)
- errs() << ")";
- errs() << "\n";
+ dbgs() << ")";
+ dbgs() << "\n";
}
void Andersens::PrintConstraints() const {
- errs() << "Constraints:\n";
+ dbgs() << "Constraints:\n";
for (unsigned i = 0, e = Constraints.size(); i != e; ++i)
PrintConstraint(Constraints[i]);
}
void Andersens::PrintPointsToGraph() const {
- errs() << "Points-to graph:\n";
+ dbgs() << "Points-to graph:\n";
for (unsigned i = 0, e = GraphNodes.size(); i != e; ++i) {
const Node *N = &GraphNodes[i];
if (FindNode(i) != i) {
PrintNode(N);
- errs() << "\t--> same as ";
+ dbgs() << "\t--> same as ";
PrintNode(&GraphNodes[FindNode(i)]);
- errs() << "\n";
+ dbgs() << "\n";
} else {
- errs() << "[" << (N->PointsTo->count()) << "] ";
+ dbgs() << "[" << (N->PointsTo->count()) << "] ";
PrintNode(N);
- errs() << "\t--> ";
+ dbgs() << "\t--> ";
bool first = true;
for (SparseBitVector<>::iterator bi = N->PointsTo->begin();
bi != N->PointsTo->end();
++bi) {
if (!first)
- errs() << ", ";
+ dbgs() << ", ";
PrintNode(&GraphNodes[*bi]);
first = false;
}
- errs() << "\n";
+ dbgs() << "\n";
}
}
}
diff --git a/lib/Analysis/IPA/CallGraph.cpp b/lib/Analysis/IPA/CallGraph.cpp
index 9cd8bb8..a826177 100644
--- a/lib/Analysis/IPA/CallGraph.cpp
+++ b/lib/Analysis/IPA/CallGraph.cpp
@@ -17,6 +17,7 @@
#include "llvm/Instructions.h"
#include "llvm/IntrinsicInst.h"
#include "llvm/Support/CallSite.h"
+#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
using namespace llvm;
@@ -181,7 +182,7 @@ void CallGraph::print(raw_ostream &OS, Module*) const {
I->second->print(OS);
}
void CallGraph::dump() const {
- print(errs(), 0);
+ print(dbgs(), 0);
}
//===----------------------------------------------------------------------===//
@@ -232,7 +233,7 @@ void CallGraphNode::print(raw_ostream &OS) const {
OS << "\n";
}
-void CallGraphNode::dump() const { print(errs()); }
+void CallGraphNode::dump() const { print(dbgs()); }
/// removeCallEdgeFor - This method removes the edge in the node for the
/// specified call site. Note that this method takes linear time, so it
diff --git a/lib/Analysis/IPA/CallGraphSCCPass.cpp b/lib/Analysis/IPA/CallGraphSCCPass.cpp
index a96a5c5..5504b9b 100644
--- a/lib/Analysis/IPA/CallGraphSCCPass.cpp
+++ b/lib/Analysis/IPA/CallGraphSCCPass.cpp
@@ -126,7 +126,7 @@ bool CGPassManager::RunPassOnSCC(Pass *P, std::vector<CallGraphNode*> &CurSCC,
// The function pass(es) modified the IR, they may have clobbered the
// callgraph.
if (Changed && CallGraphUpToDate) {
- DEBUG(errs() << "CGSCCPASSMGR: Pass Dirtied SCC: "
+ DEBUG(dbgs() << "CGSCCPASSMGR: Pass Dirtied SCC: "
<< P->getPassName() << '\n');
CallGraphUpToDate = false;
}
@@ -143,7 +143,7 @@ void CGPassManager::RefreshCallGraph(std::vector<CallGraphNode*> &CurSCC,
CallGraph &CG, bool CheckingMode) {
DenseMap<Value*, CallGraphNode*> CallSites;
- DEBUG(errs() << "CGSCCPASSMGR: Refreshing SCC with " << CurSCC.size()
+ DEBUG(dbgs() << "CGSCCPASSMGR: Refreshing SCC with " << CurSCC.size()
<< " nodes:\n";
for (unsigned i = 0, e = CurSCC.size(); i != e; ++i)
CurSCC[i]->dump();
@@ -277,11 +277,11 @@ void CGPassManager::RefreshCallGraph(std::vector<CallGraphNode*> &CurSCC,
}
DEBUG(if (MadeChange) {
- errs() << "CGSCCPASSMGR: Refreshed SCC is now:\n";
+ dbgs() << "CGSCCPASSMGR: Refreshed SCC is now:\n";
for (unsigned i = 0, e = CurSCC.size(); i != e; ++i)
CurSCC[i]->dump();
} else {
- errs() << "CGSCCPASSMGR: SCC Refresh didn't change call graph.\n";
+ dbgs() << "CGSCCPASSMGR: SCC Refresh didn't change call graph.\n";
}
);
}
diff --git a/lib/Analysis/IVUsers.cpp b/lib/Analysis/IVUsers.cpp
index 627dbbb..df9e31c 100644
--- a/lib/Analysis/IVUsers.cpp
+++ b/lib/Analysis/IVUsers.cpp
@@ -53,7 +53,7 @@ static bool containsAddRecFromDifferentLoop(const SCEV *S, Loop *L) {
if (newLoop == L)
return false;
// if newLoop is an outer loop of L, this is OK.
- if (newLoop->contains(L->getHeader()))
+ if (newLoop->contains(L))
return false;
}
return true;
@@ -128,7 +128,7 @@ static bool getSCEVStartAndStride(const SCEV *&SH, Loop *L, Loop *UseLoop,
if (!AddRecStride->properlyDominates(Header, DT))
return false;
- DEBUG(errs() << "[" << L->getHeader()->getName()
+ DEBUG(dbgs() << "[" << L->getHeader()->getName()
<< "] Variable stride: " << *AddRec << "\n");
}
@@ -148,7 +148,7 @@ static bool IVUseShouldUsePostIncValue(Instruction *User, Instruction *IV,
Loop *L, LoopInfo *LI, DominatorTree *DT,
Pass *P) {
// If the user is in the loop, use the preinc value.
- if (L->contains(User->getParent())) return false;
+ if (L->contains(User)) return false;
BasicBlock *LatchBlock = L->getLoopLatch();
if (!LatchBlock)
@@ -209,7 +209,7 @@ bool IVUsers::AddUsersIfInteresting(Instruction *I) {
return false; // Non-reducible symbolic expression, bail out.
// Keep things simple. Don't touch loop-variant strides.
- if (!Stride->isLoopInvariant(L) && L->contains(I->getParent()))
+ if (!Stride->isLoopInvariant(L) && L->contains(I))
return false;
SmallPtrSet<Instruction *, 4> UniqueUsers;
@@ -233,13 +233,13 @@ bool IVUsers::AddUsersIfInteresting(Instruction *I) {
if (LI->getLoopFor(User->getParent()) != L) {
if (isa<PHINode>(User) || Processed.count(User) ||
!AddUsersIfInteresting(User)) {
- DEBUG(errs() << "FOUND USER in other loop: " << *User << '\n'
+ DEBUG(dbgs() << "FOUND USER in other loop: " << *User << '\n'
<< " OF SCEV: " << *ISE << '\n');
AddUserToIVUsers = true;
}
} else if (Processed.count(User) ||
!AddUsersIfInteresting(User)) {
- DEBUG(errs() << "FOUND USER: " << *User << '\n'
+ DEBUG(dbgs() << "FOUND USER: " << *User << '\n'
<< " OF SCEV: " << *ISE << '\n');
AddUserToIVUsers = true;
}
@@ -262,7 +262,7 @@ bool IVUsers::AddUsersIfInteresting(Instruction *I) {
const SCEV *NewStart = SE->getMinusSCEV(Start, Stride);
StrideUses->addUser(NewStart, User, I);
StrideUses->Users.back().setIsUseOfPostIncrementedValue(true);
- DEBUG(errs() << " USING POSTINC SCEV, START=" << *NewStart<< "\n");
+ DEBUG(dbgs() << " USING POSTINC SCEV, START=" << *NewStart<< "\n");
} else {
StrideUses->addUser(Start, User, I);
}
@@ -307,7 +307,6 @@ bool IVUsers::runOnLoop(Loop *l, LPPassManager &LPM) {
for (BasicBlock::iterator I = L->getHeader()->begin(); isa<PHINode>(I); ++I)
AddUsersIfInteresting(I);
- Processed.clear();
return false;
}
@@ -325,7 +324,7 @@ const SCEV *IVUsers::getReplacementExpr(const IVStrideUse &U) const {
if (U.isUseOfPostIncrementedValue())
RetVal = SE->getAddExpr(RetVal, U.getParent()->Stride);
// Evaluate the expression out of the loop, if possible.
- if (!L->contains(U.getUser()->getParent())) {
+ if (!L->contains(U.getUser())) {
const SCEV *ExitVal = SE->getSCEVAtScope(RetVal, L->getParentLoop());
if (ExitVal->isLoopInvariant(L))
RetVal = ExitVal;
@@ -364,12 +363,13 @@ void IVUsers::print(raw_ostream &OS, const Module *M) const {
}
void IVUsers::dump() const {
- print(errs());
+ print(dbgs());
}
void IVUsers::releaseMemory() {
IVUsesByStride.clear();
StrideOrder.clear();
+ Processed.clear();
IVUses.clear();
}
diff --git a/lib/Analysis/InstCount.cpp b/lib/Analysis/InstCount.cpp
index a4b041f..bb2cf53 100644
--- a/lib/Analysis/InstCount.cpp
+++ b/lib/Analysis/InstCount.cpp
@@ -15,6 +15,7 @@
#include "llvm/Analysis/Passes.h"
#include "llvm/Pass.h"
#include "llvm/Function.h"
+#include "llvm/Support/Debug.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/InstVisitor.h"
#include "llvm/Support/raw_ostream.h"
diff --git a/lib/Analysis/LazyValueInfo.cpp b/lib/Analysis/LazyValueInfo.cpp
index 5796c6f..ff9026b 100644
--- a/lib/Analysis/LazyValueInfo.cpp
+++ b/lib/Analysis/LazyValueInfo.cpp
@@ -342,7 +342,7 @@ LVILatticeVal LVIQuery::getBlockValue(BasicBlock *BB) {
// If we've already computed this block's value, return it.
if (!BBLV.isUndefined()) {
- DEBUG(errs() << " reuse BB '" << BB->getName() << "' val=" << BBLV <<'\n');
+ DEBUG(dbgs() << " reuse BB '" << BB->getName() << "' val=" << BBLV <<'\n');
return BBLV;
}
@@ -365,7 +365,7 @@ LVILatticeVal LVIQuery::getBlockValue(BasicBlock *BB) {
// If we hit overdefined, exit early. The BlockVals entry is already set
// to overdefined.
if (Result.isOverdefined()) {
- DEBUG(errs() << " compute BB '" << BB->getName()
+ DEBUG(dbgs() << " compute BB '" << BB->getName()
<< "' - overdefined because of pred.\n");
return Result;
}
@@ -394,7 +394,7 @@ LVILatticeVal LVIQuery::getBlockValue(BasicBlock *BB) {
}
- DEBUG(errs() << " compute BB '" << BB->getName()
+ DEBUG(dbgs() << " compute BB '" << BB->getName()
<< "' - overdefined because inst def found.\n");
LVILatticeVal Result;
@@ -471,12 +471,12 @@ LVILatticeVal LazyValueInfoCache::getValueInBlock(Value *V, BasicBlock *BB) {
if (Constant *VC = dyn_cast<Constant>(V))
return LVILatticeVal::get(VC);
- DEBUG(errs() << "LVI Getting block end value " << *V << " at '"
+ DEBUG(dbgs() << "LVI Getting block end value " << *V << " at '"
<< BB->getName() << "'\n");
LVILatticeVal Result = LVIQuery(V, ValueCache[V]).getBlockValue(BB);
- DEBUG(errs() << " Result = " << Result << "\n");
+ DEBUG(dbgs() << " Result = " << Result << "\n");
return Result;
}
@@ -486,12 +486,12 @@ getValueOnEdge(Value *V, BasicBlock *FromBB, BasicBlock *ToBB) {
if (Constant *VC = dyn_cast<Constant>(V))
return LVILatticeVal::get(VC);
- DEBUG(errs() << "LVI Getting edge value " << *V << " from '"
+ DEBUG(dbgs() << "LVI Getting edge value " << *V << " from '"
<< FromBB->getName() << "' to '" << ToBB->getName() << "'\n");
LVILatticeVal Result =
LVIQuery(V, ValueCache[V]).getEdgeValue(FromBB, ToBB);
- DEBUG(errs() << " Result = " << Result << "\n");
+ DEBUG(dbgs() << " Result = " << Result << "\n");
return Result;
}
diff --git a/lib/Analysis/LoopDependenceAnalysis.cpp b/lib/Analysis/LoopDependenceAnalysis.cpp
index 32d2266..bb4f46d 100644
--- a/lib/Analysis/LoopDependenceAnalysis.cpp
+++ b/lib/Analysis/LoopDependenceAnalysis.cpp
@@ -181,15 +181,15 @@ LoopDependenceAnalysis::DependenceResult
LoopDependenceAnalysis::analyseSubscript(const SCEV *A,
const SCEV *B,
Subscript *S) const {
- DEBUG(errs() << " Testing subscript: " << *A << ", " << *B << "\n");
+ DEBUG(dbgs() << " Testing subscript: " << *A << ", " << *B << "\n");
if (A == B) {
- DEBUG(errs() << " -> [D] same SCEV\n");
+ DEBUG(dbgs() << " -> [D] same SCEV\n");
return Dependent;
}
if (!isAffine(A) || !isAffine(B)) {
- DEBUG(errs() << " -> [?] not affine\n");
+ DEBUG(dbgs() << " -> [?] not affine\n");
return Unknown;
}
@@ -204,12 +204,12 @@ LoopDependenceAnalysis::analyseSubscript(const SCEV *A,
LoopDependenceAnalysis::DependenceResult
LoopDependenceAnalysis::analysePair(DependencePair *P) const {
- DEBUG(errs() << "Analysing:\n" << *P->A << "\n" << *P->B << "\n");
+ DEBUG(dbgs() << "Analysing:\n" << *P->A << "\n" << *P->B << "\n");
// We only analyse loads and stores but no possible memory accesses by e.g.
// free, call, or invoke instructions.
if (!IsLoadOrStoreInst(P->A) || !IsLoadOrStoreInst(P->B)) {
- DEBUG(errs() << "--> [?] no load/store\n");
+ DEBUG(dbgs() << "--> [?] no load/store\n");
return Unknown;
}
@@ -219,12 +219,12 @@ LoopDependenceAnalysis::analysePair(DependencePair *P) const {
switch (UnderlyingObjectsAlias(AA, aPtr, bPtr)) {
case AliasAnalysis::MayAlias:
// We can not analyse objects if we do not know about their aliasing.
- DEBUG(errs() << "---> [?] may alias\n");
+ DEBUG(dbgs() << "---> [?] may alias\n");
return Unknown;
case AliasAnalysis::NoAlias:
// If the objects noalias, they are distinct, accesses are independent.
- DEBUG(errs() << "---> [I] no alias\n");
+ DEBUG(dbgs() << "---> [I] no alias\n");
return Independent;
case AliasAnalysis::MustAlias:
diff --git a/lib/Analysis/LoopInfo.cpp b/lib/Analysis/LoopInfo.cpp
index 34089ee..5d31c11 100644
--- a/lib/Analysis/LoopInfo.cpp
+++ b/lib/Analysis/LoopInfo.cpp
@@ -56,7 +56,7 @@ bool Loop::isLoopInvariant(Value *V) const {
/// loop-invariant.
///
bool Loop::isLoopInvariant(Instruction *I) const {
- return !contains(I->getParent());
+ return !contains(I);
}
/// makeLoopInvariant - If the given value is an instruciton inside of the
diff --git a/lib/Analysis/MemoryDependenceAnalysis.cpp b/lib/Analysis/MemoryDependenceAnalysis.cpp
index a0c7706..2d74709d 100644
--- a/lib/Analysis/MemoryDependenceAnalysis.cpp
+++ b/lib/Analysis/MemoryDependenceAnalysis.cpp
@@ -275,7 +275,8 @@ getPointerDependencyFrom(Value *MemPtr, uint64_t MemSize, bool isLoad,
// a subsequent bitcast of the malloc call result. There can be stores to
// the malloced memory between the malloc call and its bitcast uses, and we
// need to continue scanning until the malloc call.
- if (isa<AllocaInst>(Inst) || extractMallocCall(Inst)) {
+ if (isa<AllocaInst>(Inst) ||
+ (isa<CallInst>(Inst) && extractMallocCall(Inst))) {
Value *AccessPtr = MemPtr->getUnderlyingObject();
if (AccessPtr == Inst ||
@@ -546,9 +547,9 @@ MemoryDependenceAnalysis::getNonLocalCallDependency(CallSite QueryCS) {
// If we had a dirty entry for the block, update it. Otherwise, just add
// a new entry.
if (ExistingResult)
- ExistingResult->setResult(Dep, 0);
+ ExistingResult->setResult(Dep);
else
- Cache.push_back(NonLocalDepEntry(DirtyBB, Dep, 0));
+ Cache.push_back(NonLocalDepEntry(DirtyBB, Dep));
// If the block has a dependency (i.e. it isn't completely transparent to
// the value), remember the association!
@@ -578,7 +579,7 @@ MemoryDependenceAnalysis::getNonLocalCallDependency(CallSite QueryCS) {
///
void MemoryDependenceAnalysis::
getNonLocalPointerDependency(Value *Pointer, bool isLoad, BasicBlock *FromBB,
- SmallVectorImpl<NonLocalDepEntry> &Result) {
+ SmallVectorImpl<NonLocalDepResult> &Result) {
assert(isa<PointerType>(Pointer->getType()) &&
"Can't get pointer deps of a non-pointer!");
Result.clear();
@@ -599,9 +600,9 @@ getNonLocalPointerDependency(Value *Pointer, bool isLoad, BasicBlock *FromBB,
Result, Visited, true))
return;
Result.clear();
- Result.push_back(NonLocalDepEntry(FromBB,
- MemDepResult::getClobber(FromBB->begin()),
- Pointer));
+ Result.push_back(NonLocalDepResult(FromBB,
+ MemDepResult::getClobber(FromBB->begin()),
+ Pointer));
}
/// GetNonLocalInfoForBlock - Compute the memdep value for BB with
@@ -656,9 +657,9 @@ GetNonLocalInfoForBlock(Value *Pointer, uint64_t PointeeSize,
// If we had a dirty entry for the block, update it. Otherwise, just add
// a new entry.
if (ExistingResult)
- ExistingResult->setResult(Dep, Pointer);
+ ExistingResult->setResult(Dep);
else
- Cache->push_back(NonLocalDepEntry(BB, Dep, Pointer));
+ Cache->push_back(NonLocalDepEntry(BB, Dep));
// If the block has a dependency (i.e. it isn't completely transparent to
// the value), remember the reverse association because we just added it
@@ -726,7 +727,7 @@ SortNonLocalDepInfoCache(MemoryDependenceAnalysis::NonLocalDepInfo &Cache,
bool MemoryDependenceAnalysis::
getNonLocalPointerDepFromBB(const PHITransAddr &Pointer, uint64_t PointeeSize,
bool isLoad, BasicBlock *StartBB,
- SmallVectorImpl<NonLocalDepEntry> &Result,
+ SmallVectorImpl<NonLocalDepResult> &Result,
DenseMap<BasicBlock*, Value*> &Visited,
bool SkipFirstBlock) {
@@ -759,11 +760,12 @@ getNonLocalPointerDepFromBB(const PHITransAddr &Pointer, uint64_t PointeeSize,
}
}
+ Value *Addr = Pointer.getAddr();
for (NonLocalDepInfo::iterator I = Cache->begin(), E = Cache->end();
I != E; ++I) {
- Visited.insert(std::make_pair(I->getBB(), Pointer.getAddr()));
+ Visited.insert(std::make_pair(I->getBB(), Addr));
if (!I->getResult().isNonLocal())
- Result.push_back(*I);
+ Result.push_back(NonLocalDepResult(I->getBB(), I->getResult(), Addr));
}
++NumCacheCompleteNonLocalPtr;
return false;
@@ -807,7 +809,7 @@ getNonLocalPointerDepFromBB(const PHITransAddr &Pointer, uint64_t PointeeSize,
// If we got a Def or Clobber, add this to the list of results.
if (!Dep.isNonLocal()) {
- Result.push_back(NonLocalDepEntry(BB, Dep, Pointer.getAddr()));
+ Result.push_back(NonLocalDepResult(BB, Dep, Pointer.getAddr()));
continue;
}
}
@@ -889,41 +891,17 @@ getNonLocalPointerDepFromBB(const PHITransAddr &Pointer, uint64_t PointeeSize,
// a computation of the pointer in this predecessor.
if (PredPtrVal == 0) {
// Add the entry to the Result list.
- NonLocalDepEntry Entry(Pred,
- MemDepResult::getClobber(Pred->getTerminator()),
- PredPtrVal);
+ NonLocalDepResult Entry(Pred,
+ MemDepResult::getClobber(Pred->getTerminator()),
+ PredPtrVal);
Result.push_back(Entry);
- // Add it to the cache for this CacheKey so that subsequent queries get
- // this result.
- Cache = &NonLocalPointerDeps[CacheKey].second;
- MemoryDependenceAnalysis::NonLocalDepInfo::iterator It =
- std::upper_bound(Cache->begin(), Cache->end(), Entry);
-
- if (It != Cache->begin() && (It-1)->getBB() == Pred)
- --It;
-
- if (It == Cache->end() || It->getBB() != Pred) {
- Cache->insert(It, Entry);
- // Add it to the reverse map.
- ReverseNonLocalPtrDeps[Pred->getTerminator()].insert(CacheKey);
- } else if (!It->getResult().isDirty()) {
- // noop
- } else if (It->getResult().getInst() == Pred->getTerminator()) {
- // Same instruction, clear the dirty marker.
- It->setResult(Entry.getResult(), PredPtrVal);
- } else if (It->getResult().getInst() == 0) {
- // Dirty, with no instruction, just add this.
- It->setResult(Entry.getResult(), PredPtrVal);
- ReverseNonLocalPtrDeps[Pred->getTerminator()].insert(CacheKey);
- } else {
- // Otherwise, dirty with a different instruction.
- RemoveFromReverseMap(ReverseNonLocalPtrDeps,
- It->getResult().getInst(), CacheKey);
- It->setResult(Entry.getResult(),PredPtrVal);
- ReverseNonLocalPtrDeps[Pred->getTerminator()].insert(CacheKey);
- }
- Cache = 0;
+ // Since we had a phi translation failure, the cache for CacheKey won't
+ // include all of the entries that we need to immediately satisfy future
+ // queries. Mark this in NonLocalPointerDeps by setting the
+ // BBSkipFirstBlockPair pointer to null. This requires reuse of the
+ // cached value to do more work but not miss the phi trans failure.
+ NonLocalPointerDeps[CacheKey].first = BBSkipFirstBlockPair();
continue;
}
@@ -961,10 +939,10 @@ getNonLocalPointerDepFromBB(const PHITransAddr &Pointer, uint64_t PointeeSize,
NumSortedEntries = Cache->size();
}
- // Since we did phi translation, the "Cache" set won't contain all of the
+ // Since we failed phi translation, the "Cache" set won't contain all of the
// results for the query. This is ok (we can still use it to accelerate
// specific block queries) but we can't do the fastpath "return all
- // results from the set" Clear out the indicator for this.
+ // results from the set". Clear out the indicator for this.
CacheInfo->first = BBSkipFirstBlockPair();
// If *nothing* works, mark the pointer as being clobbered by the first
@@ -983,9 +961,10 @@ getNonLocalPointerDepFromBB(const PHITransAddr &Pointer, uint64_t PointeeSize,
assert(I->getResult().isNonLocal() &&
"Should only be here with transparent block");
- I->setResult(MemDepResult::getClobber(BB->begin()), Pointer.getAddr());
+ I->setResult(MemDepResult::getClobber(BB->begin()));
ReverseNonLocalPtrDeps[BB->begin()].insert(CacheKey);
- Result.push_back(*I);
+ Result.push_back(NonLocalDepResult(I->getBB(), I->getResult(),
+ Pointer.getAddr()));
break;
}
}
@@ -1139,7 +1118,7 @@ void MemoryDependenceAnalysis::removeInstruction(Instruction *RemInst) {
if (DI->getResult().getInst() != RemInst) continue;
// Convert to a dirty entry for the subsequent instruction.
- DI->setResult(NewDirtyVal, DI->getAddress());
+ DI->setResult(NewDirtyVal);
if (Instruction *NextI = NewDirtyVal.getInst())
ReverseDepsToAdd.push_back(std::make_pair(NextI, *I));
@@ -1181,7 +1160,7 @@ void MemoryDependenceAnalysis::removeInstruction(Instruction *RemInst) {
if (DI->getResult().getInst() != RemInst) continue;
// Convert to a dirty entry for the subsequent instruction.
- DI->setResult(NewDirtyVal, DI->getAddress());
+ DI->setResult(NewDirtyVal);
if (Instruction *NewDirtyInst = NewDirtyVal.getInst())
ReversePtrDepsToAdd.push_back(std::make_pair(NewDirtyInst, P));
diff --git a/lib/Analysis/PHITransAddr.cpp b/lib/Analysis/PHITransAddr.cpp
index 07e2919..334a188 100644
--- a/lib/Analysis/PHITransAddr.cpp
+++ b/lib/Analysis/PHITransAddr.cpp
@@ -14,6 +14,7 @@
#include "llvm/Analysis/PHITransAddr.h"
#include "llvm/Analysis/Dominators.h"
#include "llvm/Analysis/InstructionSimplify.h"
+#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
using namespace llvm;
@@ -35,12 +36,12 @@ static bool CanPHITrans(Instruction *Inst) {
void PHITransAddr::dump() const {
if (Addr == 0) {
- errs() << "PHITransAddr: null\n";
+ dbgs() << "PHITransAddr: null\n";
return;
}
- errs() << "PHITransAddr: " << *Addr << "\n";
+ dbgs() << "PHITransAddr: " << *Addr << "\n";
for (unsigned i = 0, e = InstInputs.size(); i != e; ++i)
- errs() << " Input #" << i << " is " << *InstInputs[i] << "\n";
+ dbgs() << " Input #" << i << " is " << *InstInputs[i] << "\n";
}
diff --git a/lib/Analysis/PostDominators.cpp b/lib/Analysis/PostDominators.cpp
index 69d6b47..c38e050 100644
--- a/lib/Analysis/PostDominators.cpp
+++ b/lib/Analysis/PostDominators.cpp
@@ -33,7 +33,7 @@ F("postdomtree", "Post-Dominator Tree Construction", true, true);
bool PostDominatorTree::runOnFunction(Function &F) {
DT->recalculate(F);
- DEBUG(DT->print(errs()));
+ DEBUG(DT->print(dbgs()));
return false;
}
diff --git a/lib/Analysis/ProfileEstimatorPass.cpp b/lib/Analysis/ProfileEstimatorPass.cpp
index 8148429..cf9311a 100644
--- a/lib/Analysis/ProfileEstimatorPass.cpp
+++ b/lib/Analysis/ProfileEstimatorPass.cpp
@@ -87,11 +87,11 @@ static double ignoreMissing(double w) {
}
static void inline printEdgeError(ProfileInfo::Edge e, const char *M) {
- DEBUG(errs() << "-- Edge " << e << " is not calculated, " << M << "\n");
+ DEBUG(dbgs() << "-- Edge " << e << " is not calculated, " << M << "\n");
}
void inline ProfileEstimatorPass::printEdgeWeight(Edge E) {
- DEBUG(errs() << "-- Weight of Edge " << E << ":"
+ DEBUG(dbgs() << "-- Weight of Edge " << E << ":"
<< format("%20.20g", getEdgeWeight(E)) << "\n");
}
@@ -179,7 +179,7 @@ void ProfileEstimatorPass::recurseBasicBlock(BasicBlock *BB) {
// from weight.
if (MinimalWeight.find(*ei) != MinimalWeight.end()) {
incoming -= MinimalWeight[*ei];
- DEBUG(errs() << "Reserving " << format("%.20g",MinimalWeight[*ei]) << " at " << (*ei) << "\n");
+ DEBUG(dbgs() << "Reserving " << format("%.20g",MinimalWeight[*ei]) << " at " << (*ei) << "\n");
}
} else {
incoming -= w;
@@ -217,7 +217,7 @@ void ProfileEstimatorPass::recurseBasicBlock(BasicBlock *BB) {
// Read necessary minimal weight.
if (MinimalWeight.find(*ei) != MinimalWeight.end()) {
EdgeInformation[BB->getParent()][*ei] += MinimalWeight[*ei];
- DEBUG(errs() << "Additionally " << format("%.20g",MinimalWeight[*ei]) << " at " << (*ei) << "\n");
+ DEBUG(dbgs() << "Additionally " << format("%.20g",MinimalWeight[*ei]) << " at " << (*ei) << "\n");
}
printEdgeWeight(*ei);
@@ -232,7 +232,7 @@ void ProfileEstimatorPass::recurseBasicBlock(BasicBlock *BB) {
MinimalWeight[e] = 0;
}
MinimalWeight[e] += w;
- DEBUG(errs() << "Minimal Weight for " << e << ": " << format("%.20g",MinimalWeight[e]) << "\n");
+ DEBUG(dbgs() << "Minimal Weight for " << e << ": " << format("%.20g",MinimalWeight[e]) << "\n");
Dest = Parent;
}
}
@@ -268,7 +268,7 @@ void ProfileEstimatorPass::recurseBasicBlock(BasicBlock *BB) {
// from block weight, this is readded later on.
if (MinimalWeight.find(edge) != MinimalWeight.end()) {
BBWeight -= MinimalWeight[edge];
- DEBUG(errs() << "Reserving " << format("%.20g",MinimalWeight[edge]) << " at " << edge << "\n");
+ DEBUG(dbgs() << "Reserving " << format("%.20g",MinimalWeight[edge]) << " at " << edge << "\n");
}
}
}
@@ -288,7 +288,7 @@ void ProfileEstimatorPass::recurseBasicBlock(BasicBlock *BB) {
// Readd minial necessary weight.
if (MinimalWeight.find(*ei) != MinimalWeight.end()) {
EdgeInformation[BB->getParent()][*ei] += MinimalWeight[*ei];
- DEBUG(errs() << "Additionally " << format("%.20g",MinimalWeight[*ei]) << " at " << (*ei) << "\n");
+ DEBUG(dbgs() << "Additionally " << format("%.20g",MinimalWeight[*ei]) << " at " << (*ei) << "\n");
}
printEdgeWeight(*ei);
}
@@ -319,7 +319,7 @@ bool ProfileEstimatorPass::runOnFunction(Function &F) {
// Clear Minimal Edges.
MinimalWeight.clear();
- DEBUG(errs() << "Working on function " << F.getNameStr() << "\n");
+ DEBUG(dbgs() << "Working on function " << F.getNameStr() << "\n");
// Since the entry block is the first one and has no predecessors, the edge
// (0,entry) is inserted with the starting weight of 1.
@@ -366,7 +366,7 @@ bool ProfileEstimatorPass::runOnFunction(Function &F) {
if (Dest != *bbi) {
// If there is no circle, just set edge weight to 0
EdgeInformation[&F][e] = 0;
- DEBUG(errs() << "Assuming edge weight: ");
+ DEBUG(dbgs() << "Assuming edge weight: ");
printEdgeWeight(e);
found = true;
}
@@ -375,7 +375,7 @@ bool ProfileEstimatorPass::runOnFunction(Function &F) {
}
if (!found) {
cleanup = true;
- DEBUG(errs() << "No assumption possible in Fuction "<<F.getName()<<", setting all to zero\n");
+ DEBUG(dbgs() << "No assumption possible in Fuction "<<F.getName()<<", setting all to zero\n");
}
}
}
diff --git a/lib/Analysis/ProfileInfo.cpp b/lib/Analysis/ProfileInfo.cpp
index c49c6e1..afd86b1 100644
--- a/lib/Analysis/ProfileInfo.cpp
+++ b/lib/Analysis/ProfileInfo.cpp
@@ -163,7 +163,7 @@ double ProfileInfoT<MachineFunction, MachineBasicBlock>::
template<>
void ProfileInfoT<Function,BasicBlock>::
setExecutionCount(const BasicBlock *BB, double w) {
- DEBUG(errs() << "Creating Block " << BB->getName()
+ DEBUG(dbgs() << "Creating Block " << BB->getName()
<< " (weight: " << format("%.20g",w) << ")\n");
BlockInformation[BB->getParent()][BB] = w;
}
@@ -171,7 +171,7 @@ void ProfileInfoT<Function,BasicBlock>::
template<>
void ProfileInfoT<MachineFunction, MachineBasicBlock>::
setExecutionCount(const MachineBasicBlock *MBB, double w) {
- DEBUG(errs() << "Creating Block " << MBB->getBasicBlock()->getName()
+ DEBUG(dbgs() << "Creating Block " << MBB->getBasicBlock()->getName()
<< " (weight: " << format("%.20g",w) << ")\n");
BlockInformation[MBB->getParent()][MBB] = w;
}
@@ -180,7 +180,7 @@ template<>
void ProfileInfoT<Function,BasicBlock>::addEdgeWeight(Edge e, double w) {
double oldw = getEdgeWeight(e);
assert (oldw != MissingValue && "Adding weight to Edge with no previous weight");
- DEBUG(errs() << "Adding to Edge " << e
+ DEBUG(dbgs() << "Adding to Edge " << e
<< " (new weight: " << format("%.20g",oldw + w) << ")\n");
EdgeInformation[getFunction(e)][e] = oldw + w;
}
@@ -190,7 +190,7 @@ void ProfileInfoT<Function,BasicBlock>::
addExecutionCount(const BasicBlock *BB, double w) {
double oldw = getExecutionCount(BB);
assert (oldw != MissingValue && "Adding weight to Block with no previous weight");
- DEBUG(errs() << "Adding to Block " << BB->getName()
+ DEBUG(dbgs() << "Adding to Block " << BB->getName()
<< " (new weight: " << format("%.20g",oldw + w) << ")\n");
BlockInformation[BB->getParent()][BB] = oldw + w;
}
@@ -201,7 +201,7 @@ void ProfileInfoT<Function,BasicBlock>::removeBlock(const BasicBlock *BB) {
BlockInformation.find(BB->getParent());
if (J == BlockInformation.end()) return;
- DEBUG(errs() << "Deleting " << BB->getName() << "\n");
+ DEBUG(dbgs() << "Deleting " << BB->getName() << "\n");
J->second.erase(BB);
}
@@ -211,7 +211,7 @@ void ProfileInfoT<Function,BasicBlock>::removeEdge(Edge e) {
EdgeInformation.find(getFunction(e));
if (J == EdgeInformation.end()) return;
- DEBUG(errs() << "Deleting" << e << "\n");
+ DEBUG(dbgs() << "Deleting" << e << "\n");
J->second.erase(e);
}
@@ -221,10 +221,10 @@ void ProfileInfoT<Function,BasicBlock>::
double w;
if ((w = getEdgeWeight(newedge)) == MissingValue) {
w = getEdgeWeight(oldedge);
- DEBUG(errs() << "Replacing " << oldedge << " with " << newedge << "\n");
+ DEBUG(dbgs() << "Replacing " << oldedge << " with " << newedge << "\n");
} else {
w += getEdgeWeight(oldedge);
- DEBUG(errs() << "Adding " << oldedge << " to " << newedge << "\n");
+ DEBUG(dbgs() << "Adding " << oldedge << " to " << newedge << "\n");
}
setEdgeWeight(newedge,w);
removeEdge(oldedge);
@@ -277,7 +277,7 @@ const BasicBlock *ProfileInfoT<Function,BasicBlock>::
template<>
void ProfileInfoT<Function,BasicBlock>::
divertFlow(const Edge &oldedge, const Edge &newedge) {
- DEBUG(errs() << "Diverting " << oldedge << " via " << newedge );
+ DEBUG(dbgs() << "Diverting " << oldedge << " via " << newedge );
// First check if the old edge was taken, if not, just delete it...
if (getEdgeWeight(oldedge) == 0) {
@@ -291,7 +291,7 @@ void ProfileInfoT<Function,BasicBlock>::
const BasicBlock *BB = GetPath(newedge.second,oldedge.second,P,GetPathToExit | GetPathToDest);
double w = getEdgeWeight (oldedge);
- DEBUG(errs() << ", Weight: " << format("%.20g",w) << "\n");
+ DEBUG(dbgs() << ", Weight: " << format("%.20g",w) << "\n");
do {
const BasicBlock *Parent = P.find(BB)->second;
Edge e = getEdge(Parent,BB);
@@ -312,7 +312,7 @@ void ProfileInfoT<Function,BasicBlock>::
template<>
void ProfileInfoT<Function,BasicBlock>::
replaceAllUses(const BasicBlock *RmBB, const BasicBlock *DestBB) {
- DEBUG(errs() << "Replacing " << RmBB->getName()
+ DEBUG(dbgs() << "Replacing " << RmBB->getName()
<< " with " << DestBB->getName() << "\n");
const Function *F = DestBB->getParent();
std::map<const Function*, EdgeWeights>::iterator J =
@@ -413,7 +413,7 @@ void ProfileInfoT<Function,BasicBlock>::splitBlock(const BasicBlock *Old,
EdgeInformation.find(F);
if (J == EdgeInformation.end()) return;
- DEBUG(errs() << "Splitting " << Old->getName() << " to " << New->getName() << "\n");
+ DEBUG(dbgs() << "Splitting " << Old->getName() << " to " << New->getName() << "\n");
std::set<Edge> Edges;
for (EdgeWeights::iterator ewi = J->second.begin(), ewe = J->second.end();
@@ -444,7 +444,7 @@ void ProfileInfoT<Function,BasicBlock>::splitBlock(const BasicBlock *BB,
EdgeInformation.find(F);
if (J == EdgeInformation.end()) return;
- DEBUG(errs() << "Splitting " << NumPreds << " Edges from " << BB->getName()
+ DEBUG(dbgs() << "Splitting " << NumPreds << " Edges from " << BB->getName()
<< " to " << NewBB->getName() << "\n");
// Collect weight that was redirected over NewBB.
@@ -474,7 +474,7 @@ void ProfileInfoT<Function,BasicBlock>::splitBlock(const BasicBlock *BB,
template<>
void ProfileInfoT<Function,BasicBlock>::transfer(const Function *Old,
const Function *New) {
- DEBUG(errs() << "Replacing Function " << Old->getName() << " with "
+ DEBUG(dbgs() << "Replacing Function " << Old->getName() << " with "
<< New->getName() << "\n");
std::map<const Function*, EdgeWeights>::iterator J =
EdgeInformation.find(Old);
@@ -552,7 +552,7 @@ bool ProfileInfoT<Function,BasicBlock>::
} else {
EdgeInformation[BB->getParent()][edgetocalc] = incount-outcount;
}
- DEBUG(errs() << "--Calc Edge Counter for " << edgetocalc << ": "
+ DEBUG(dbgs() << "--Calc Edge Counter for " << edgetocalc << ": "
<< format("%.20g", getEdgeWeight(edgetocalc)) << "\n");
removed = edgetocalc;
return true;
@@ -982,9 +982,9 @@ void ProfileInfoT<Function,BasicBlock>::repair(const Function *F) {
FI = Unvisited.begin(), FE = Unvisited.end();
while(FI != FE) {
const BasicBlock *BB = *FI; ++FI;
- errs() << BB->getName();
+ dbgs() << BB->getName();
if (FI != FE)
- errs() << ",";
+ dbgs() << ",";
}
errs() << "}";
diff --git a/lib/Analysis/ProfileInfoLoaderPass.cpp b/lib/Analysis/ProfileInfoLoaderPass.cpp
index cbd0430..d8c511f 100644
--- a/lib/Analysis/ProfileInfoLoaderPass.cpp
+++ b/lib/Analysis/ProfileInfoLoaderPass.cpp
@@ -131,7 +131,7 @@ void LoaderPass::readEdge(ProfileInfo::Edge e,
// in double.
EdgeInformation[getFunction(e)][e] += (double)weight;
- DEBUG(errs() << "--Read Edge Counter for " << e
+ DEBUG(dbgs() << "--Read Edge Counter for " << e
<< " (# "<< (ReadCount-1) << "): "
<< (unsigned)getEdgeWeight(e) << "\n");
} else {
@@ -151,7 +151,7 @@ bool LoaderPass::runOnModule(Module &M) {
ReadCount = 0;
for (Module::iterator F = M.begin(), E = M.end(); F != E; ++F) {
if (F->isDeclaration()) continue;
- DEBUG(errs()<<"Working on "<<F->getNameStr()<<"\n");
+ DEBUG(dbgs()<<"Working on "<<F->getNameStr()<<"\n");
readEdge(getEdge(0,&F->getEntryBlock()), Counters);
for (Function::iterator BB = F->begin(), E = F->end(); BB != E; ++BB) {
TerminatorInst *TI = BB->getTerminator();
@@ -172,7 +172,7 @@ bool LoaderPass::runOnModule(Module &M) {
ReadCount = 0;
for (Module::iterator F = M.begin(), E = M.end(); F != E; ++F) {
if (F->isDeclaration()) continue;
- DEBUG(errs()<<"Working on "<<F->getNameStr()<<"\n");
+ DEBUG(dbgs()<<"Working on "<<F->getNameStr()<<"\n");
readEdge(getEdge(0,&F->getEntryBlock()), Counters);
for (Function::iterator BB = F->begin(), E = F->end(); BB != E; ++BB) {
TerminatorInst *TI = BB->getTerminator();
@@ -198,10 +198,10 @@ bool LoaderPass::runOnModule(Module &M) {
}
if (SpanningTree.size() == size) {
- DEBUG(errs()<<"{");
+ DEBUG(dbgs()<<"{");
for (std::set<Edge>::iterator ei = SpanningTree.begin(),
ee = SpanningTree.end(); ei != ee; ++ei) {
- DEBUG(errs()<< *ei <<",");
+ DEBUG(dbgs()<< *ei <<",");
}
assert(0 && "No edge calculated!");
}
diff --git a/lib/Analysis/ProfileVerifierPass.cpp b/lib/Analysis/ProfileVerifierPass.cpp
index 36a80ba..a2ddc8e 100644
--- a/lib/Analysis/ProfileVerifierPass.cpp
+++ b/lib/Analysis/ProfileVerifierPass.cpp
@@ -102,7 +102,7 @@ namespace llvm {
typename ProfileInfoT<FType, BType>::Edge E = PI->getEdge(*bbi,BB);
double EdgeWeight = PI->getEdgeWeight(E);
if (EdgeWeight == ProfileInfoT<FType, BType>::MissingValue) { EdgeWeight = 0; }
- errs() << "calculated in-edge " << E << ": "
+ dbgs() << "calculated in-edge " << E << ": "
<< format("%20.20g",EdgeWeight) << "\n";
inWeight += EdgeWeight;
inCount++;
@@ -117,13 +117,13 @@ namespace llvm {
typename ProfileInfoT<FType, BType>::Edge E = PI->getEdge(BB,*bbi);
double EdgeWeight = PI->getEdgeWeight(E);
if (EdgeWeight == ProfileInfoT<FType, BType>::MissingValue) { EdgeWeight = 0; }
- errs() << "calculated out-edge " << E << ": "
+ dbgs() << "calculated out-edge " << E << ": "
<< format("%20.20g",EdgeWeight) << "\n";
outWeight += EdgeWeight;
outCount++;
}
}
- errs() << "Block " << BB->getNameStr() << " in "
+ dbgs() << "Block " << BB->getNameStr() << " in "
<< BB->getParent()->getNameStr() << ":"
<< "BBWeight=" << format("%20.20g",BBWeight) << ","
<< "inWeight=" << format("%20.20g",inWeight) << ","
@@ -141,7 +141,7 @@ namespace llvm {
template<class FType, class BType>
void ProfileVerifierPassT<FType, BType>::debugEntry (DetailedBlockInfo *DI) {
- errs() << "TROUBLE: Block " << DI->BB->getNameStr() << " in "
+ dbgs() << "TROUBLE: Block " << DI->BB->getNameStr() << " in "
<< DI->BB->getParent()->getNameStr() << ":"
<< "BBWeight=" << format("%20.20g",DI->BBWeight) << ","
<< "inWeight=" << format("%20.20g",DI->inWeight) << ","
@@ -191,20 +191,20 @@ namespace llvm {
}
#define ASSERTMESSAGE(M) \
- { errs() << "ASSERT:" << (M) << "\n"; \
+ { dbgs() << "ASSERT:" << (M) << "\n"; \
if (!DisableAssertions) assert(0 && (M)); }
template<class FType, class BType>
double ProfileVerifierPassT<FType, BType>::ReadOrAssert(typename ProfileInfoT<FType, BType>::Edge E) {
double EdgeWeight = PI->getEdgeWeight(E);
if (EdgeWeight == ProfileInfoT<FType, BType>::MissingValue) {
- errs() << "Edge " << E << " in Function "
+ dbgs() << "Edge " << E << " in Function "
<< ProfileInfoT<FType, BType>::getFunction(E)->getNameStr() << ": ";
ASSERTMESSAGE("Edge has missing value");
return 0;
} else {
if (EdgeWeight < 0) {
- errs() << "Edge " << E << " in Function "
+ dbgs() << "Edge " << E << " in Function "
<< ProfileInfoT<FType, BType>::getFunction(E)->getNameStr() << ": ";
ASSERTMESSAGE("Edge has negative value");
}
@@ -218,7 +218,7 @@ namespace llvm {
DetailedBlockInfo *DI) {
if (Error) {
DEBUG(debugEntry(DI));
- errs() << "Block " << DI->BB->getNameStr() << " in Function "
+ dbgs() << "Block " << DI->BB->getNameStr() << " in Function "
<< DI->BB->getParent()->getNameStr() << ": ";
ASSERTMESSAGE(Message);
}
diff --git a/lib/Analysis/ScalarEvolution.cpp b/lib/Analysis/ScalarEvolution.cpp
index c6835ef..17dc686 100644
--- a/lib/Analysis/ScalarEvolution.cpp
+++ b/lib/Analysis/ScalarEvolution.cpp
@@ -75,6 +75,7 @@
#include "llvm/Target/TargetData.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/ConstantRange.h"
+#include "llvm/Support/Debug.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/GetElementPtrTypeIterator.h"
#include "llvm/Support/InstIterator.h"
@@ -117,8 +118,8 @@ char ScalarEvolution::ID = 0;
SCEV::~SCEV() {}
void SCEV::dump() const {
- print(errs());
- errs() << '\n';
+ print(dbgs());
+ dbgs() << '\n';
}
bool SCEV::isZero() const {
@@ -298,7 +299,7 @@ bool SCEVAddRecExpr::isLoopInvariant(const Loop *QueryLoop) const {
return false;
// This recurrence is variant w.r.t. QueryLoop if QueryLoop contains L.
- if (QueryLoop->contains(L->getHeader()))
+ if (QueryLoop->contains(L))
return false;
// This recurrence is variant w.r.t. QueryLoop if any of its operands
@@ -333,7 +334,7 @@ bool SCEVUnknown::isLoopInvariant(const Loop *L) const {
// Instructions are never considered invariant in the function body
// (null loop) because they are defined within the "loop".
if (Instruction *I = dyn_cast<Instruction>(V))
- return L && !L->contains(I->getParent());
+ return L && !L->contains(I);
return true;
}
@@ -1457,10 +1458,13 @@ const SCEV *ScalarEvolution::getAddExpr(SmallVectorImpl<const SCEV *> &Ops,
LIOps.push_back(AddRec->getStart());
SmallVector<const SCEV *, 4> AddRecOps(AddRec->op_begin(),
- AddRec->op_end());
+ AddRec->op_end());
AddRecOps[0] = getAddExpr(LIOps);
+ // It's tempting to propagate NUW/NSW flags here, but nuw/nsw addition
+ // is not associative so this isn't necessarily safe.
const SCEV *NewRec = getAddRecExpr(AddRecOps, AddRec->getLoop());
+
// If all of the other operands were loop invariant, we are done.
if (Ops.size() == 1) return NewRec;
@@ -1636,6 +1640,8 @@ const SCEV *ScalarEvolution::getMulExpr(SmallVectorImpl<const SCEV *> &Ops,
}
}
+ // It's tempting to propagate the NSW flag here, but nsw multiplication
+ // is not associative so this isn't necessarily safe.
const SCEV *NewRec = getAddRecExpr(NewOps, AddRec->getLoop());
// If all of the other operands were loop invariant, we are done.
@@ -1838,10 +1844,10 @@ ScalarEvolution::getAddRecExpr(SmallVectorImpl<const SCEV *> &Operands,
// Canonicalize nested AddRecs in by nesting them in order of loop depth.
if (const SCEVAddRecExpr *NestedAR = dyn_cast<SCEVAddRecExpr>(Operands[0])) {
- const Loop* NestedLoop = NestedAR->getLoop();
+ const Loop *NestedLoop = NestedAR->getLoop();
if (L->getLoopDepth() < NestedLoop->getLoopDepth()) {
SmallVector<const SCEV *, 4> NestedOperands(NestedAR->op_begin(),
- NestedAR->op_end());
+ NestedAR->op_end());
Operands[0] = NestedAR->getStart();
// AddRecs require their operands be loop-invariant with respect to their
// loops. Don't perform this transformation if it would break this
@@ -2441,7 +2447,7 @@ ScalarEvolution::ForgetSymbolicName(Instruction *I, const SCEV *SymName) {
Instruction *I = Worklist.pop_back_val();
if (!Visited.insert(I)) continue;
- std::map<SCEVCallbackVH, const SCEV*>::iterator It =
+ std::map<SCEVCallbackVH, const SCEV *>::iterator It =
Scalars.find(static_cast<Value *>(I));
if (It != Scalars.end()) {
// Short-circuit the def-use traversal if the symbolic name
@@ -2592,8 +2598,9 @@ const SCEV *ScalarEvolution::createNodeForPHI(PHINode *PN) {
/// createNodeForGEP - Expand GEP instructions into add and multiply
/// operations. This allows them to be analyzed by regular SCEV code.
///
-const SCEV *ScalarEvolution::createNodeForGEP(Operator *GEP) {
+const SCEV *ScalarEvolution::createNodeForGEP(GEPOperator *GEP) {
+ bool InBounds = GEP->isInBounds();
const Type *IntPtrTy = getEffectiveSCEVType(GEP->getType());
Value *Base = GEP->getOperand(0);
// Don't attempt to analyze GEPs over unsized objects.
@@ -2610,18 +2617,23 @@ const SCEV *ScalarEvolution::createNodeForGEP(Operator *GEP) {
// For a struct, add the member offset.
unsigned FieldNo = cast<ConstantInt>(Index)->getZExtValue();
TotalOffset = getAddExpr(TotalOffset,
- getFieldOffsetExpr(STy, FieldNo));
+ getFieldOffsetExpr(STy, FieldNo),
+ /*HasNUW=*/false, /*HasNSW=*/InBounds);
} else {
// For an array, add the element offset, explicitly scaled.
const SCEV *LocalOffset = getSCEV(Index);
if (!isa<PointerType>(LocalOffset->getType()))
// Getelementptr indicies are signed.
LocalOffset = getTruncateOrSignExtend(LocalOffset, IntPtrTy);
- LocalOffset = getMulExpr(LocalOffset, getAllocSizeExpr(*GTI));
- TotalOffset = getAddExpr(TotalOffset, LocalOffset);
+ // Lower "inbounds" GEPs to NSW arithmetic.
+ LocalOffset = getMulExpr(LocalOffset, getAllocSizeExpr(*GTI),
+ /*HasNUW=*/false, /*HasNSW=*/InBounds);
+ TotalOffset = getAddExpr(TotalOffset, LocalOffset,
+ /*HasNUW=*/false, /*HasNSW=*/InBounds);
}
}
- return getAddExpr(getSCEV(Base), TotalOffset);
+ return getAddExpr(getSCEV(Base), TotalOffset,
+ /*HasNUW=*/false, /*HasNSW=*/InBounds);
}
/// GetMinTrailingZeros - Determine the minimum number of zero bits that S is
@@ -3130,7 +3142,7 @@ const SCEV *ScalarEvolution::createSCEV(Value *V) {
// expressions we handle are GEPs and address literals.
case Instruction::GetElementPtr:
- return createNodeForGEP(U);
+ return createNodeForGEP(cast<GEPOperator>(U));
case Instruction::PHI:
return createNodeForPHI(cast<PHINode>(U));
@@ -3241,7 +3253,7 @@ ScalarEvolution::getBackedgeTakenInfo(const Loop *L) {
// update the value. The temporary CouldNotCompute value tells SCEV
// code elsewhere that it shouldn't attempt to request a new
// backedge-taken count, which could result in infinite recursion.
- std::pair<std::map<const Loop*, BackedgeTakenInfo>::iterator, bool> Pair =
+ std::pair<std::map<const Loop *, BackedgeTakenInfo>::iterator, bool> Pair =
BackedgeTakenCounts.insert(std::make_pair(L, getCouldNotCompute()));
if (Pair.second) {
BackedgeTakenInfo ItCount = ComputeBackedgeTakenCount(L);
@@ -3276,7 +3288,7 @@ ScalarEvolution::getBackedgeTakenInfo(const Loop *L) {
Instruction *I = Worklist.pop_back_val();
if (!Visited.insert(I)) continue;
- std::map<SCEVCallbackVH, const SCEV*>::iterator It =
+ std::map<SCEVCallbackVH, const SCEV *>::iterator It =
Scalars.find(static_cast<Value *>(I));
if (It != Scalars.end()) {
// SCEVUnknown for a PHI either means that it has an unrecognized
@@ -3316,7 +3328,7 @@ void ScalarEvolution::forgetLoop(const Loop *L) {
Instruction *I = Worklist.pop_back_val();
if (!Visited.insert(I)) continue;
- std::map<SCEVCallbackVH, const SCEV*>::iterator It =
+ std::map<SCEVCallbackVH, const SCEV *>::iterator It =
Scalars.find(static_cast<Value *>(I));
if (It != Scalars.end()) {
ValuesAtScopes.erase(It->second);
@@ -3333,7 +3345,7 @@ void ScalarEvolution::forgetLoop(const Loop *L) {
/// of the specified loop will execute.
ScalarEvolution::BackedgeTakenInfo
ScalarEvolution::ComputeBackedgeTakenCount(const Loop *L) {
- SmallVector<BasicBlock*, 8> ExitingBlocks;
+ SmallVector<BasicBlock *, 8> ExitingBlocks;
L->getExitingBlocks(ExitingBlocks);
// Examine all exits and pick the most conservative values.
@@ -3616,10 +3628,10 @@ ScalarEvolution::ComputeBackedgeTakenCountFromExitCondICmp(const Loop *L,
}
default:
#if 0
- errs() << "ComputeBackedgeTakenCount ";
+ dbgs() << "ComputeBackedgeTakenCount ";
if (ExitCond->getOperand(0)->getType()->isUnsigned())
- errs() << "[unsigned] ";
- errs() << *LHS << " "
+ dbgs() << "[unsigned] ";
+ dbgs() << *LHS << " "
<< Instruction::getOpcodeName(Instruction::ICmp)
<< " " << *RHS << "\n";
#endif
@@ -3740,7 +3752,7 @@ ScalarEvolution::ComputeLoadConstantCompareBackedgeTakenCount(
if (!isa<ConstantInt>(Result)) break; // Couldn't decide for sure
if (cast<ConstantInt>(Result)->getValue().isMinValue()) {
#if 0
- errs() << "\n***\n*** Computed loop count " << *ItCst
+ dbgs() << "\n***\n*** Computed loop count " << *ItCst
<< "\n*** From global " << *GV << "*** BB: " << *L->getHeader()
<< "***\n";
#endif
@@ -3774,7 +3786,7 @@ static PHINode *getConstantEvolvingPHI(Value *V, const Loop *L) {
// If this is not an instruction, or if this is an instruction outside of the
// loop, it can't be derived from a loop PHI.
Instruction *I = dyn_cast<Instruction>(V);
- if (I == 0 || !L->contains(I->getParent())) return 0;
+ if (I == 0 || !L->contains(I)) return 0;
if (PHINode *PN = dyn_cast<PHINode>(I)) {
if (L->getHeader() == I->getParent())
@@ -3839,7 +3851,7 @@ static Constant *EvaluateExpression(Value *V, Constant *PHIVal,
/// involving constants, fold it.
Constant *
ScalarEvolution::getConstantEvolutionLoopExitValue(PHINode *PN,
- const APInt& BEs,
+ const APInt &BEs,
const Loop *L) {
std::map<PHINode*, Constant*>::iterator I =
ConstantEvolutionLoopExitValue.find(PN);
@@ -4008,7 +4020,7 @@ const SCEV *ScalarEvolution::computeSCEVAtScope(const SCEV *V, const Loop *L) {
if (!isSCEVable(Op->getType()))
return V;
- const SCEV* OpV = getSCEVAtScope(Op, L);
+ const SCEV *OpV = getSCEVAtScope(Op, L);
if (const SCEVConstant *SC = dyn_cast<SCEVConstant>(OpV)) {
Constant *C = SC->getValue();
if (C->getType() != Op->getType())
@@ -4091,7 +4103,7 @@ const SCEV *ScalarEvolution::computeSCEVAtScope(const SCEV *V, const Loop *L) {
// If this is a loop recurrence for a loop that does not contain L, then we
// are dealing with the final value computed by the loop.
if (const SCEVAddRecExpr *AddRec = dyn_cast<SCEVAddRecExpr>(V)) {
- if (!L || !AddRec->getLoop()->contains(L->getHeader())) {
+ if (!L || !AddRec->getLoop()->contains(L)) {
// To evaluate this recurrence, we need to know how many times the AddRec
// loop iterates. Compute this now.
const SCEV *BackedgeTakenCount = getBackedgeTakenCount(AddRec->getLoop());
@@ -4306,7 +4318,7 @@ const SCEV *ScalarEvolution::HowFarToZero(const SCEV *V, const Loop *L) {
const SCEVConstant *R2 = dyn_cast<SCEVConstant>(Roots.second);
if (R1) {
#if 0
- errs() << "HFTZ: " << *V << " - sol#1: " << *R1
+ dbgs() << "HFTZ: " << *V << " - sol#1: " << *R1
<< " sol#2: " << *R2 << "\n";
#endif
// Pick the smallest positive root value.
@@ -5183,7 +5195,7 @@ static void PrintLoopInfo(raw_ostream &OS, ScalarEvolution *SE,
OS << "Loop " << L->getHeader()->getName() << ": ";
- SmallVector<BasicBlock*, 8> ExitBlocks;
+ SmallVector<BasicBlock *, 8> ExitBlocks;
L->getExitBlocks(ExitBlocks);
if (ExitBlocks.size() != 1)
OS << "<multiple exits> ";
@@ -5206,14 +5218,14 @@ static void PrintLoopInfo(raw_ostream &OS, ScalarEvolution *SE,
OS << "\n";
}
-void ScalarEvolution::print(raw_ostream &OS, const Module* ) const {
+void ScalarEvolution::print(raw_ostream &OS, const Module *) const {
// ScalarEvolution's implementaiton of the print method is to print
// out SCEV values of all instructions that are interesting. Doing
// this potentially causes it to create new SCEV objects though,
// which technically conflicts with the const qualifier. This isn't
// observable from outside the class though, so casting away the
// const isn't dangerous.
- ScalarEvolution &SE = *const_cast<ScalarEvolution*>(this);
+ ScalarEvolution &SE = *const_cast<ScalarEvolution *>(this);
OS << "Classifying expressions for: " << F->getName() << "\n";
for (inst_iterator I = inst_begin(F), E = inst_end(F); I != E; ++I)
diff --git a/lib/Analysis/SparsePropagation.cpp b/lib/Analysis/SparsePropagation.cpp
index d7bcac2..d8c207b 100644
--- a/lib/Analysis/SparsePropagation.cpp
+++ b/lib/Analysis/SparsePropagation.cpp
@@ -17,7 +17,6 @@
#include "llvm/Constants.h"
#include "llvm/Function.h"
#include "llvm/Instructions.h"
-#include "llvm/LLVMContext.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
using namespace llvm;
@@ -89,7 +88,7 @@ void SparseSolver::UpdateState(Instruction &Inst, LatticeVal V) {
/// MarkBlockExecutable - This method can be used by clients to mark all of
/// the blocks that are known to be intrinsically live in the processed unit.
void SparseSolver::MarkBlockExecutable(BasicBlock *BB) {
- DEBUG(errs() << "Marking Block Executable: " << BB->getName() << "\n");
+ DEBUG(dbgs() << "Marking Block Executable: " << BB->getName() << "\n");
BBExecutable.insert(BB); // Basic block is executable!
BBWorkList.push_back(BB); // Add the block to the work list!
}
@@ -100,7 +99,7 @@ void SparseSolver::markEdgeExecutable(BasicBlock *Source, BasicBlock *Dest) {
if (!KnownFeasibleEdges.insert(Edge(Source, Dest)).second)
return; // This edge is already known to be executable!
- DEBUG(errs() << "Marking Edge Executable: " << Source->getName()
+ DEBUG(dbgs() << "Marking Edge Executable: " << Source->getName()
<< " -> " << Dest->getName() << "\n");
if (BBExecutable.count(Dest)) {
@@ -155,7 +154,7 @@ void SparseSolver::getFeasibleSuccessors(TerminatorInst &TI,
}
// Constant condition variables mean the branch can only go a single way
- Succs[C == ConstantInt::getFalse(*Context)] = true;
+ Succs[C->isNullValue()] = true;
return;
}
@@ -300,7 +299,7 @@ void SparseSolver::Solve(Function &F) {
Instruction *I = InstWorkList.back();
InstWorkList.pop_back();
- DEBUG(errs() << "\nPopped off I-WL: " << *I << "\n");
+ DEBUG(dbgs() << "\nPopped off I-WL: " << *I << "\n");
// "I" got into the work list because it made a transition. See if any
// users are both live and in need of updating.
@@ -317,7 +316,7 @@ void SparseSolver::Solve(Function &F) {
BasicBlock *BB = BBWorkList.back();
BBWorkList.pop_back();
- DEBUG(errs() << "\nPopped off BBWL: " << *BB);
+ DEBUG(dbgs() << "\nPopped off BBWL: " << *BB);
// Notify all instructions in this basic block that they are newly
// executable.
diff --git a/lib/Analysis/Trace.cpp b/lib/Analysis/Trace.cpp
index c9b303b..68a39cd 100644
--- a/lib/Analysis/Trace.cpp
+++ b/lib/Analysis/Trace.cpp
@@ -18,6 +18,7 @@
#include "llvm/Analysis/Trace.h"
#include "llvm/Function.h"
#include "llvm/Assembly/Writer.h"
+#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
using namespace llvm;
@@ -46,5 +47,5 @@ void Trace::print(raw_ostream &O) const {
/// output stream.
///
void Trace::dump() const {
- print(errs());
+ print(dbgs());
}
diff --git a/lib/Analysis/ValueTracking.cpp b/lib/Analysis/ValueTracking.cpp
index 22c6e3b..acd3119 100644
--- a/lib/Analysis/ValueTracking.cpp
+++ b/lib/Analysis/ValueTracking.cpp
@@ -1369,11 +1369,6 @@ bool llvm::GetConstantStringInfo(Value *V, std::string &Str, uint64_t Offset,
StopAtNul);
}
- if (MDString *MDStr = dyn_cast<MDString>(V)) {
- Str = MDStr->getString();
- return true;
- }
-
// The GEP instruction, constant or instruction, must reference a global
// variable that is a constant and is initialized. The referenced constant
// initializer is the array that we'll use for optimization.
OpenPOWER on IntegriCloud