From 985dac65791b9f6f631bdd51c18fe66592a67469 Mon Sep 17 00:00:00 2001 From: Shuxin Yang Date: Wed, 6 Mar 2013 17:48:48 +0000 Subject: Memory Dependence Analysis (not mem-dep test) take advantage of "invariant.load" metadata. The "invariant.load" metadata indicates the memory unit being accessed is immutable. A load annotated with this metadata can be moved across any store. As I am not sure if it is legal to move such loads across barrier/fence, this change dose not allow such transformation. rdar://11311484 Thank Arnold for code review. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@176562 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Analysis/MemoryDependenceAnalysis.h | 7 +++++-- include/llvm/IR/LLVMContext.h | 3 ++- 2 files changed, 7 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/llvm/Analysis/MemoryDependenceAnalysis.h b/include/llvm/Analysis/MemoryDependenceAnalysis.h index b87f886c00..47afd1b77b 100644 --- a/include/llvm/Analysis/MemoryDependenceAnalysis.h +++ b/include/llvm/Analysis/MemoryDependenceAnalysis.h @@ -391,14 +391,17 @@ namespace llvm { /// getPointerDependencyFrom - Return the instruction on which a memory /// location depends. If isLoad is true, this routine ignores may-aliases /// with read-only operations. If isLoad is false, this routine ignores - /// may-aliases with reads from read-only locations. + /// may-aliases with reads from read-only locations. If possible, pass + /// the query instruction as well; this function may take advantage of + /// the metadata annotated to the query instruction to refine the result. /// /// Note that this is an uncached query, and thus may be inefficient. /// MemDepResult getPointerDependencyFrom(const AliasAnalysis::Location &Loc, bool isLoad, BasicBlock::iterator ScanIt, - BasicBlock *BB); + BasicBlock *BB, + Instruction *QueryInst = 0); /// getLoadLoadClobberFullWidthSize - This is a little bit of analysis that diff --git a/include/llvm/IR/LLVMContext.h b/include/llvm/IR/LLVMContext.h index b3c558bbcd..ae81e5b1c3 100644 --- a/include/llvm/IR/LLVMContext.h +++ b/include/llvm/IR/LLVMContext.h @@ -46,7 +46,8 @@ public: MD_prof = 2, // "prof" MD_fpmath = 3, // "fpmath" MD_range = 4, // "range" - MD_tbaa_struct = 5 // "tbaa.struct" + MD_tbaa_struct = 5, // "tbaa.struct" + MD_invariant_load = 6 // "invariant.load" }; /// getMDKindID - Return a unique non-zero ID for the specified metadata kind. -- cgit v1.2.3