Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion llvm/include/llvm/IR/ConstantFold.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ namespace llvm {
Constant *V2);
Constant *ConstantFoldCompareInstruction(CmpInst::Predicate Predicate,
Constant *C1, Constant *C2);
Constant *ConstantFoldGetElementPtr(Type *Ty, Constant *C,
Constant *ConstantFoldGetElementPtr(Constant *C,
std::optional<ConstantRange> InRange,
ArrayRef<Value *> Idxs);
} // End llvm namespace
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/Analysis/InstructionSimplify.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5127,7 +5127,7 @@ static Value *simplifyGEPInst(Type *SrcTy, Value *Ptr,
return nullptr;

if (!ConstantExpr::isSupportedGetElementPtr(SrcTy))
return ConstantFoldGetElementPtr(SrcTy, cast<Constant>(Ptr), std::nullopt,
return ConstantFoldGetElementPtr(cast<Constant>(Ptr), std::nullopt,
Indices);

auto *CE =
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/IR/ConstantFold.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1312,7 +1312,7 @@ Constant *llvm::ConstantFoldCompareInstruction(CmpInst::Predicate Predicate,
return nullptr;
}

Constant *llvm::ConstantFoldGetElementPtr(Type *PointeeTy, Constant *C,
Constant *llvm::ConstantFoldGetElementPtr(Constant *C,
std::optional<ConstantRange> InRange,
ArrayRef<Value *> Idxs) {
if (Idxs.empty()) return C;
Expand Down
4 changes: 2 additions & 2 deletions llvm/lib/IR/Constants.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -732,7 +732,7 @@ static bool constantIsDead(const Constant *C, bool RemoveDeadUsers) {
ReplaceableMetadataImpl::SalvageDebugInfo(*C);
const_cast<Constant *>(C)->destroyConstant();
}

return true;
}

Expand Down Expand Up @@ -2509,7 +2509,7 @@ Constant *ConstantExpr::getGetElementPtr(Type *Ty, Constant *C,
assert(Ty && "Must specify element type");
assert(isSupportedGetElementPtr(Ty) && "Element type is unsupported!");

if (Constant *FC = ConstantFoldGetElementPtr(Ty, C, InRange, Idxs))
if (Constant *FC = ConstantFoldGetElementPtr(C, InRange, Idxs))
return FC; // Fold a few common cases.

assert(GetElementPtrInst::getIndexedType(Ty, Idxs) && "GEP indices invalid!");
Expand Down