summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/IPO/StripSymbols.cpp5
-rw-r--r--llvm/lib/Transforms/Scalar/SROA.cpp12
-rw-r--r--llvm/lib/Transforms/Scalar/SampleProfile.cpp2
-rw-r--r--llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp6
-rw-r--r--llvm/lib/Transforms/Utils/AddDiscriminators.cpp4
-rw-r--r--llvm/lib/Transforms/Utils/Local.cpp20
6 files changed, 23 insertions, 26 deletions
diff --git a/llvm/lib/Transforms/IPO/StripSymbols.cpp b/llvm/lib/Transforms/IPO/StripSymbols.cpp
index ef43dd2d37b..bcead02d80a 100644
--- a/llvm/lib/Transforms/IPO/StripSymbols.cpp
+++ b/llvm/lib/Transforms/IPO/StripSymbols.cpp
@@ -321,11 +321,8 @@ bool StripDeadDebugInfo::runOnModule(Module &M) {
}
// Create our live global variable list.
- MDGlobalVariableArray GVs = DIC->getGlobalVariables();
bool GlobalVariableChange = false;
- for (unsigned i = 0, e = GVs.size(); i != e; ++i) {
- DIGlobalVariable DIG = GVs[i];
-
+ for (MDGlobalVariable *DIG : DIC->getGlobalVariables()) {
// Make sure we only visit each global variable only once.
if (!VisitedSet.insert(DIG).second)
continue;
diff --git a/llvm/lib/Transforms/Scalar/SROA.cpp b/llvm/lib/Transforms/Scalar/SROA.cpp
index 59dc52811c9..e11ab33b0fb 100644
--- a/llvm/lib/Transforms/Scalar/SROA.cpp
+++ b/llvm/lib/Transforms/Scalar/SROA.cpp
@@ -1166,9 +1166,9 @@ public:
} else {
continue;
}
- DIB.insertDbgValueIntrinsic(Arg, 0, DIVariable(DVI->getVariable()),
- DIExpression(DVI->getExpression()),
- DVI->getDebugLoc(), Inst);
+ DIB.insertDbgValueIntrinsic(Arg, 0, DVI->getVariable(),
+ DVI->getExpression(), DVI->getDebugLoc(),
+ Inst);
}
}
};
@@ -4181,15 +4181,15 @@ bool SROA::splitAlloca(AllocaInst &AI, AllocaSlices &AS) {
// Migrate debug information from the old alloca to the new alloca(s)
// and the individial partitions.
if (DbgDeclareInst *DbgDecl = FindAllocaDbgDeclare(&AI)) {
- DIVariable Var(DbgDecl->getVariable());
- DIExpression Expr(DbgDecl->getExpression());
+ auto *Var = DbgDecl->getVariable();
+ auto *Expr = DbgDecl->getExpression();
DIBuilder DIB(*AI.getParent()->getParent()->getParent(),
/*AllowUnresolved*/ false);
bool IsSplit = Pieces.size() > 1;
for (auto Piece : Pieces) {
// Create a piece expression describing the new partition or reuse AI's
// expression if there is only one partition.
- DIExpression PieceExpr = Expr;
+ auto *PieceExpr = Expr;
if (IsSplit || Expr->isBitPiece()) {
// If this alloca is already a scalar replacement of a larger aggregate,
// Piece.Offset describes the offset inside the scalar.
diff --git a/llvm/lib/Transforms/Scalar/SampleProfile.cpp b/llvm/lib/Transforms/Scalar/SampleProfile.cpp
index f99fe3f5512..f4936b57062 100644
--- a/llvm/lib/Transforms/Scalar/SampleProfile.cpp
+++ b/llvm/lib/Transforms/Scalar/SampleProfile.cpp
@@ -224,7 +224,7 @@ unsigned SampleProfileLoader::getInstWeight(Instruction &Inst) {
if (Lineno < HeaderLineno)
return 0;
- DILocation DIL = DLoc.get();
+ const MDLocation *DIL = DLoc;
int LOffset = Lineno - HeaderLineno;
unsigned Discriminator = DIL->getDiscriminator();
unsigned Weight = Samples->samplesAt(LOffset, Discriminator);
diff --git a/llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp b/llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp
index 693c5ae9708..03fff1df5d9 100644
--- a/llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp
+++ b/llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp
@@ -1117,9 +1117,9 @@ public:
} else {
continue;
}
- DIB->insertDbgValueIntrinsic(Arg, 0, DIVariable(DVI->getVariable()),
- DIExpression(DVI->getExpression()),
- DVI->getDebugLoc(), Inst);
+ DIB->insertDbgValueIntrinsic(Arg, 0, DVI->getVariable(),
+ DVI->getExpression(), DVI->getDebugLoc(),
+ Inst);
}
}
};
diff --git a/llvm/lib/Transforms/Utils/AddDiscriminators.cpp b/llvm/lib/Transforms/Utils/AddDiscriminators.cpp
index dd88f3d0a26..125aab2fe88 100644
--- a/llvm/lib/Transforms/Utils/AddDiscriminators.cpp
+++ b/llvm/lib/Transforms/Utils/AddDiscriminators.cpp
@@ -174,14 +174,14 @@ bool AddDiscriminators::runOnFunction(Function &F) {
for (Function::iterator I = F.begin(), E = F.end(); I != E; ++I) {
BasicBlock *B = I;
TerminatorInst *Last = B->getTerminator();
- DILocation LastDIL = Last->getDebugLoc().get();
+ const MDLocation *LastDIL = Last->getDebugLoc();
if (!LastDIL)
continue;
for (unsigned I = 0; I < Last->getNumSuccessors(); ++I) {
BasicBlock *Succ = Last->getSuccessor(I);
Instruction *First = Succ->getFirstNonPHIOrDbgOrLifetime();
- DILocation FirstDIL = First->getDebugLoc().get();
+ const MDLocation *FirstDIL = First->getDebugLoc();
if (!FirstDIL)
continue;
diff --git a/llvm/lib/Transforms/Utils/Local.cpp b/llvm/lib/Transforms/Utils/Local.cpp
index 5672a36a458..492dc07d1eb 100644
--- a/llvm/lib/Transforms/Utils/Local.cpp
+++ b/llvm/lib/Transforms/Utils/Local.cpp
@@ -978,7 +978,7 @@ unsigned llvm::getOrEnforceKnownAlignment(Value *V, unsigned PrefAlign,
///
/// See if there is a dbg.value intrinsic for DIVar before I.
-static bool LdStHasDebugValue(DIVariable &DIVar, Instruction *I) {
+static bool LdStHasDebugValue(const MDLocalVariable *DIVar, Instruction *I) {
// Since we can't guarantee that the original dbg.declare instrinsic
// is removed by LowerDbgDeclare(), we need to make sure that we are
// not inserting the same dbg.value intrinsic over and over.
@@ -998,8 +998,8 @@ static bool LdStHasDebugValue(DIVariable &DIVar, Instruction *I) {
/// that has an associated llvm.dbg.decl intrinsic.
bool llvm::ConvertDebugDeclareToDebugValue(DbgDeclareInst *DDI,
StoreInst *SI, DIBuilder &Builder) {
- DIVariable DIVar = DDI->getVariable();
- DIExpression DIExpr = DDI->getExpression();
+ auto *DIVar = DDI->getVariable();
+ auto *DIExpr = DDI->getExpression();
assert(DIVar && "Missing variable");
if (LdStHasDebugValue(DIVar, SI))
@@ -1025,8 +1025,8 @@ bool llvm::ConvertDebugDeclareToDebugValue(DbgDeclareInst *DDI,
/// that has an associated llvm.dbg.decl intrinsic.
bool llvm::ConvertDebugDeclareToDebugValue(DbgDeclareInst *DDI,
LoadInst *LI, DIBuilder &Builder) {
- DIVariable DIVar = DDI->getVariable();
- DIExpression DIExpr = DDI->getExpression();
+ auto *DIVar = DDI->getVariable();
+ auto *DIExpr = DDI->getExpression();
assert(DIVar && "Missing variable");
if (LdStHasDebugValue(DIVar, LI))
@@ -1075,9 +1075,9 @@ bool llvm::LowerDbgDeclare(Function &F) {
// This is a call by-value or some other instruction that
// takes a pointer to the variable. Insert a *value*
// intrinsic that describes the alloca.
- DIB.insertDbgValueIntrinsic(AI, 0, DIVariable(DDI->getVariable()),
- DIExpression(DDI->getExpression()),
- DDI->getDebugLoc(), CI);
+ DIB.insertDbgValueIntrinsic(AI, 0, DDI->getVariable(),
+ DDI->getExpression(), DDI->getDebugLoc(),
+ CI);
}
DDI->eraseFromParent();
}
@@ -1103,8 +1103,8 @@ bool llvm::replaceDbgDeclareForAlloca(AllocaInst *AI, Value *NewAllocaAddress,
if (!DDI)
return false;
DebugLoc Loc = DDI->getDebugLoc();
- DIVariable DIVar = DDI->getVariable();
- DIExpression DIExpr = DDI->getExpression();
+ auto *DIVar = DDI->getVariable();
+ auto *DIExpr = DDI->getExpression();
assert(DIVar && "Missing variable");
if (Deref) {
OpenPOWER on IntegriCloud