LazyValueInfo: Actually re-visit partially solved block-values in solveBlockValue()
[oota-llvm.git] / lib / Analysis / PtrUseVisitor.cpp
1 //===- PtrUseVisitor.cpp - InstVisitors over a pointers uses --------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 /// \file
10 /// Implementation of the pointer use visitors.
11 ///
12 //===----------------------------------------------------------------------===//
13
14 #include "llvm/Analysis/PtrUseVisitor.h"
15
16 using namespace llvm;
17
18 void detail::PtrUseVisitorBase::enqueueUsers(Instruction &I) {
19   for (Use &U : I.uses()) {
20     if (VisitedUses.insert(&U).second) {
21       UseToVisit NewU = {
22         UseToVisit::UseAndIsOffsetKnownPair(&U, IsOffsetKnown),
23         Offset
24       };
25       Worklist.push_back(std::move(NewU));
26     }
27   }
28 }
29
30 bool detail::PtrUseVisitorBase::adjustOffsetForGEP(GetElementPtrInst &GEPI) {
31   if (!IsOffsetKnown)
32     return false;
33
34   return GEPI.accumulateConstantOffset(DL, Offset);
35 }