Skip to content

Commit 1772e03

Browse files
committed
fix depreciated warning
1 parent e4d5edd commit 1772e03

File tree

2 files changed

+25
-9
lines changed

2 files changed

+25
-9
lines changed

llvm/include/llvm/Transforms/IPO/Attributor.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6306,13 +6306,17 @@ struct AAPointerInfo : public AbstractAttribute {
63066306

63076307
// Merge two access paths into one.
63086308
void mergeAccessPaths(const AccessPathSetTy *AccessPathsNew) const {
6309+
assert(AccessPathsNew != nullptr &&
6310+
"Expected the set of access paths to be non null!");
63096311
for (auto *Path : *AccessPathsNew)
63106312
if (!existsChain(Path))
63116313
AccessPaths->insert(Path);
63126314
}
63136315

63146316
// Check if the given access paths are same.
63156317
bool checkAccessPathsAreSame(const AccessPathSetTy *AccessPathsR) const {
6318+
assert(AccessPathsR != nullptr &&
6319+
"Expected the set of access paths to be non null!");
63166320
bool IsSame = true;
63176321
if (AccessPaths->size() != AccessPathsR->size())
63186322
return false;
@@ -6326,6 +6330,10 @@ struct AAPointerInfo : public AbstractAttribute {
63266330

63276331
// Check if the chain exists in the AccessPathsSet.
63286332
bool existsChain(const AccessPathTy *NewPath) const {
6333+
6334+
if (AccessPaths == nullptr)
6335+
return false;
6336+
63296337
for (auto *OldPath : *AccessPaths)
63306338
if (*OldPath == *NewPath)
63316339
return true;
@@ -6336,6 +6344,11 @@ struct AAPointerInfo : public AbstractAttribute {
63366344
void dumpAccessPaths(raw_ostream &O) const {
63376345
O << "Print all access paths found:"
63386346
<< "\n";
6347+
6348+
if (AccessPaths == nullptr) {
6349+
O << "Could not find any access paths!\n";
6350+
}
6351+
63396352
for (auto *It : *AccessPaths) {
63406353
O << "Backtrack a unique access path:\n";
63416354
for (Value *Ins : *It) {

llvm/lib/Transforms/IPO/AttributorAttributes.cpp

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13931,12 +13931,13 @@ struct AAAllocationInfoImpl : public AAAllocationInfo {
1393113931
Type *PointeeTy = OldLoadInst->getPointerOperandType();
1393213932
int64_t ShiftValue = OffsetNew - OffsetOld;
1393313933
Value *IndexList[1] = {ConstantInt::get(Int64TyInteger, ShiftValue)};
13934-
Value *GepToNewAddress = GetElementPtrInst::Create(
13935-
PointeeTy, PointerOperand, IndexList, "NewGep", OldLoadInst);
13934+
Value *GepToNewAddress =
13935+
GetElementPtrInst::Create(PointeeTy, PointerOperand, IndexList,
13936+
"NewGep", OldLoadInst->getIterator());
1393613937

1393713938
LoadInst *NewLoadInst = new LoadInst(
1393813939
OldLoadInst->getType(), GepToNewAddress, OldLoadInst->getName(),
13939-
false, OldLoadInst->getAlign(), OldLoadInst);
13940+
false, OldLoadInst->getAlign(), OldLoadInst->getIterator());
1394013941

1394113942
Changed |=
1394213943
A.changeAfterManifest(IRPosition::inst(*OldLoadInst), *NewLoadInst);
@@ -13954,12 +13955,13 @@ struct AAAllocationInfoImpl : public AAAllocationInfo {
1395413955
cast<Instruction>(OldStoreInst->getPointerOperand());
1395513956
Type *PointeeTy = OldStoreInst->getPointerOperandType();
1395613957
Value *IndexList[1] = {ConstantInt::get(Int64TyInteger, ShiftValue)};
13957-
Value *GepToNewAddress = GetElementPtrInst::Create(
13958-
PointeeTy, PointerOperand, IndexList, "NewGep", OldStoreInst);
13958+
Value *GepToNewAddress =
13959+
GetElementPtrInst::Create(PointeeTy, PointerOperand, IndexList,
13960+
"NewGep", OldStoreInst->getIterator());
1395913961

13960-
StoreInst *NewStoreInst =
13961-
new StoreInst(OldStoreInst->getValueOperand(), GepToNewAddress,
13962-
false, OldStoreInst->getAlign(), OldStoreInst);
13962+
StoreInst *NewStoreInst = new StoreInst(
13963+
OldStoreInst->getValueOperand(), GepToNewAddress, false,
13964+
OldStoreInst->getAlign(), OldStoreInst->getIterator());
1396313965

1396413966
Changed |= A.changeAfterManifest(IRPosition::inst(*OldStoreInst),
1396513967
*NewStoreInst);
@@ -13973,7 +13975,8 @@ struct AAAllocationInfoImpl : public AAAllocationInfo {
1397313975
Value *IndexList[1] = {ConstantInt::get(Int64TyInteger, OffsetNew)};
1397413976
Value *OldPointerOperand = OldGEP->getPointerOperand();
1397513977
Value *GepToNewAddress = GetElementPtrInst::Create(
13976-
NewAllocationType, OldPointerOperand, IndexList, "NewGep", OldGEP);
13978+
NewAllocationType, OldPointerOperand, IndexList, "NewGep",
13979+
OldGEP->getIterator());
1397713980

1397813981
Changed |=
1397913982
A.changeAfterManifest(IRPosition::inst(*OldGEP), *GepToNewAddress);

0 commit comments

Comments
 (0)