summaryrefslogtreecommitdiff
path: root/llvm/include/llvm/Analysis/Utils/Local.h
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/include/llvm/Analysis/Utils/Local.h')
-rw-r--r--llvm/include/llvm/Analysis/Utils/Local.h18
1 files changed, 10 insertions, 8 deletions
diff --git a/llvm/include/llvm/Analysis/Utils/Local.h b/llvm/include/llvm/Analysis/Utils/Local.h
index ca505960cbeb7..f31b563454244 100644
--- a/llvm/include/llvm/Analysis/Utils/Local.h
+++ b/llvm/include/llvm/Analysis/Utils/Local.h
@@ -14,7 +14,7 @@
#ifndef LLVM_ANALYSIS_UTILS_LOCAL_H
#define LLVM_ANALYSIS_UTILS_LOCAL_H
-#include "llvm/ADT/Twine.h"
+#include "llvm/ADT/StringRef.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/GetElementPtrTypeIterator.h"
@@ -57,39 +57,41 @@ Value *EmitGEPOffset(IRBuilderTy *Builder, const DataLayout &DL, User *GEP,
if (Size)
Result = Builder->CreateAdd(Result, ConstantInt::get(IntIdxTy, Size),
- GEP->getName()+".offs");
+ GEP->getName().str()+".offs");
continue;
}
// Splat the constant if needed.
if (IntIdxTy->isVectorTy() && !OpC->getType()->isVectorTy())
- OpC = ConstantVector::getSplat(IntIdxTy->getVectorNumElements(), OpC);
+ OpC = ConstantVector::getSplat(
+ cast<VectorType>(IntIdxTy)->getElementCount(), OpC);
Constant *Scale = ConstantInt::get(IntIdxTy, Size);
Constant *OC = ConstantExpr::getIntegerCast(OpC, IntIdxTy, true /*SExt*/);
Scale =
ConstantExpr::getMul(OC, Scale, false /*NUW*/, isInBounds /*NSW*/);
// Emit an add instruction.
- Result = Builder->CreateAdd(Result, Scale, GEP->getName()+".offs");
+ Result = Builder->CreateAdd(Result, Scale, GEP->getName().str()+".offs");
continue;
}
// Splat the index if needed.
if (IntIdxTy->isVectorTy() && !Op->getType()->isVectorTy())
- Op = Builder->CreateVectorSplat(IntIdxTy->getVectorNumElements(), Op);
+ Op = Builder->CreateVectorSplat(
+ cast<VectorType>(IntIdxTy)->getNumElements(), Op);
// Convert to correct type.
if (Op->getType() != IntIdxTy)
- Op = Builder->CreateIntCast(Op, IntIdxTy, true, Op->getName()+".c");
+ Op = Builder->CreateIntCast(Op, IntIdxTy, true, Op->getName().str()+".c");
if (Size != 1) {
// We'll let instcombine(mul) convert this to a shl if possible.
Op = Builder->CreateMul(Op, ConstantInt::get(IntIdxTy, Size),
- GEP->getName() + ".idx", false /*NUW*/,
+ GEP->getName().str() + ".idx", false /*NUW*/,
isInBounds /*NSW*/);
}
// Emit an add instruction.
- Result = Builder->CreateAdd(Op, Result, GEP->getName()+".offs");
+ Result = Builder->CreateAdd(Op, Result, GEP->getName().str()+".offs");
}
return Result;
}