From 5461d45abf940b51cfe97eaa0a7cf274d43cb394 Mon Sep 17 00:00:00 2001 From: Philip Reames Date: Thu, 23 Apr 2015 17:36:48 +0000 Subject: Move Value.isDereferenceablePointer to ValueTracking [NFC] Move isDereferenceablePointer function to Analysis. This function recursively tracks dereferencability over a chain of values like other functions in ValueTracking. This refactoring is motivated by further changes to support dereferenceable_or_null attribute (http://reviews.llvm.org/D8650). isDereferenceablePointer will be extended to perform context-sensitive analysis and IR is not a good place to have such functionality. Patch by: Artur Pilipenko Differential Revision: reviews.llvm.org/D9075 llvm-svn: 235611 --- llvm/lib/Analysis/MemDerefPrinter.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'llvm/lib/Analysis/MemDerefPrinter.cpp') diff --git a/llvm/lib/Analysis/MemDerefPrinter.cpp b/llvm/lib/Analysis/MemDerefPrinter.cpp index 6119a3d..5903dc5 100644 --- a/llvm/lib/Analysis/MemDerefPrinter.cpp +++ b/llvm/lib/Analysis/MemDerefPrinter.cpp @@ -10,6 +10,7 @@ #include "llvm/Analysis/Passes.h" #include "llvm/ADT/SetVector.h" #include "llvm/Analysis/MemoryDependenceAnalysis.h" +#include "llvm/Analysis/ValueTracking.h" #include "llvm/IR/CallSite.h" #include "llvm/IR/DataLayout.h" #include "llvm/IR/InstIterator.h" @@ -53,7 +54,7 @@ bool MemDerefPrinter::runOnFunction(Function &F) { for (auto &I: inst_range(F)) { if (LoadInst *LI = dyn_cast(&I)) { Value *PO = LI->getPointerOperand(); - if (PO->isDereferenceablePointer(DL)) + if (isDereferenceablePointer(PO, DL)) Vec.push_back(PO); } } -- cgit v1.1