[llvm] r301276 - InferAddressSpaces: Use reference arguments instead of pointers
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 24 16:42:41 PDT 2017
Author: arsenm
Date: Mon Apr 24 18:42:41 2017
New Revision: 301276
URL: http://llvm.org/viewvc/llvm-project?rev=301276&view=rev
Log:
InferAddressSpaces: Use reference arguments instead of pointers
Modified:
llvm/trunk/lib/Transforms/Scalar/InferAddressSpaces.cpp
Modified: llvm/trunk/lib/Transforms/Scalar/InferAddressSpaces.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/InferAddressSpaces.cpp?rev=301276&r1=301275&r2=301276&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/InferAddressSpaces.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/InferAddressSpaces.cpp Mon Apr 24 18:42:41 2017
@@ -152,15 +152,15 @@ private:
Function *F) const;
void appendsFlatAddressExpressionToPostorderStack(
- Value *V, std::vector<std::pair<Value *, bool>> *PostorderStack,
- DenseSet<Value *> *Visited) const;
+ Value *V, std::vector<std::pair<Value *, bool>> &PostorderStack,
+ DenseSet<Value *> &Visited) const;
bool rewriteIntrinsicOperands(IntrinsicInst *II,
Value *OldV, Value *NewV) const;
void collectRewritableIntrinsicOperands(
IntrinsicInst *II,
- std::vector<std::pair<Value *, bool>> *PostorderStack,
- DenseSet<Value *> *Visited) const;
+ std::vector<std::pair<Value *, bool>> &PostorderStack,
+ DenseSet<Value *> &Visited) const;
std::vector<Value *> collectFlatAddressExpressions(Function &F) const;
@@ -253,8 +253,8 @@ bool InferAddressSpaces::rewriteIntrinsi
// TODO: Move logic to TTI?
void InferAddressSpaces::collectRewritableIntrinsicOperands(
- IntrinsicInst *II, std::vector<std::pair<Value *, bool>> *PostorderStack,
- DenseSet<Value *> *Visited) const {
+ IntrinsicInst *II, std::vector<std::pair<Value *, bool>> &PostorderStack,
+ DenseSet<Value *> &Visited) const {
switch (II->getIntrinsicID()) {
case Intrinsic::objectsize:
case Intrinsic::amdgcn_atomic_inc:
@@ -271,13 +271,13 @@ void InferAddressSpaces::collectRewritab
// If V is an unvisited flat address expression, appends V to PostorderStack
// and marks it as visited.
void InferAddressSpaces::appendsFlatAddressExpressionToPostorderStack(
- Value *V, std::vector<std::pair<Value *, bool>> *PostorderStack,
- DenseSet<Value *> *Visited) const {
+ Value *V, std::vector<std::pair<Value *, bool>> &PostorderStack,
+ DenseSet<Value *> &Visited) const {
assert(V->getType()->isPointerTy());
if (isAddressExpression(*V) &&
V->getType()->getPointerAddressSpace() == FlatAddrSpace) {
- if (Visited->insert(V).second)
- PostorderStack->push_back(std::make_pair(V, false));
+ if (Visited.insert(V).second)
+ PostorderStack.push_back(std::make_pair(V, false));
}
}
@@ -292,8 +292,8 @@ InferAddressSpaces::collectFlatAddressEx
DenseSet<Value *> Visited;
auto PushPtrOperand = [&](Value *Ptr) {
- appendsFlatAddressExpressionToPostorderStack(Ptr, &PostorderStack,
- &Visited);
+ appendsFlatAddressExpressionToPostorderStack(Ptr, PostorderStack,
+ Visited);
};
// Look at operations that may be interesting accelerate by moving to a known
@@ -319,7 +319,7 @@ InferAddressSpaces::collectFlatAddressEx
if (auto *MTI = dyn_cast<MemTransferInst>(MI))
PushPtrOperand(MTI->getRawSource());
} else if (auto *II = dyn_cast<IntrinsicInst>(&I))
- collectRewritableIntrinsicOperands(II, &PostorderStack, &Visited);
+ collectRewritableIntrinsicOperands(II, PostorderStack, Visited);
else if (ICmpInst *Cmp = dyn_cast<ICmpInst>(&I)) {
// FIXME: Handle vectors of pointers
if (Cmp->getOperand(0)->getType()->isPointerTy()) {
@@ -341,8 +341,8 @@ InferAddressSpaces::collectFlatAddressEx
// Otherwise, adds its operands to the stack and explores them.
PostorderStack.back().second = true;
for (Value *PtrOperand : getPointerOperands(*PostorderStack.back().first)) {
- appendsFlatAddressExpressionToPostorderStack(PtrOperand, &PostorderStack,
- &Visited);
+ appendsFlatAddressExpressionToPostorderStack(PtrOperand, PostorderStack,
+ Visited);
}
}
return Postorder;
More information about the llvm-commits
mailing list