mirror of
https://github.com/RPCS3/llvm.git
synced 2024-12-26 22:26:16 +00:00
5401ba7099
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... git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222334 91177308-0d34-0410-b5e6-96231b3b80d8
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);
|
|
}
|