mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-25 20:23:11 +01:00
60e6c80905
This is to be consistent with StringSet and ultimately with the standard library's associative container insert function. This lead to updating SmallSet::insert to return pair<iterator, bool>, and then to update SmallPtrSet::insert to return pair<iterator, bool>, and then to update all the existing users of those functions... llvm-svn: 222334
36 lines
1.0 KiB
C++
36 lines
1.0 KiB
C++
//===- PtrUseVisitor.cpp - InstVisitors over a pointers uses --------------===//
|
|
//
|
|
// The LLVM Compiler Infrastructure
|
|
//
|
|
// This file is distributed under the University of Illinois Open Source
|
|
// License. See LICENSE.TXT for details.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
/// \file
|
|
/// Implementation of the pointer use visitors.
|
|
///
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "llvm/Analysis/PtrUseVisitor.h"
|
|
|
|
using namespace llvm;
|
|
|
|
void detail::PtrUseVisitorBase::enqueueUsers(Instruction &I) {
|
|
for (Use &U : I.uses()) {
|
|
if (VisitedUses.insert(&U).second) {
|
|
UseToVisit NewU = {
|
|
UseToVisit::UseAndIsOffsetKnownPair(&U, IsOffsetKnown),
|
|
Offset
|
|
};
|
|
Worklist.push_back(std::move(NewU));
|
|
}
|
|
}
|
|
}
|
|
|
|
bool detail::PtrUseVisitorBase::adjustOffsetForGEP(GetElementPtrInst &GEPI) {
|
|
if (!IsOffsetKnown)
|
|
return false;
|
|
|
|
return GEPI.accumulateConstantOffset(DL, Offset);
|
|
}
|