diff options
author | Chris Lattner <sabre@nondot.org> | 2009-11-11 00:22:30 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-11-11 00:22:30 +0000 |
commit | 10f2d13d580da348ba9769864f02d0d5a862c1e0 (patch) | |
tree | d2bc48620d1f25d724e0b2b486975e622f4f93f1 | |
parent | b14b88a40ab12996c2982c4bc10fd35bb9a371d4 (diff) |
Stub out a new lazy value info pass, which will eventually
vend value constraint information to the optimizer.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86767 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/llvm/Analysis/LazyValueInfo.h | 43 | ||||
-rw-r--r-- | include/llvm/Analysis/Passes.h | 6 | ||||
-rw-r--r-- | include/llvm/LinkAllPasses.h | 1 | ||||
-rw-r--r-- | lib/Analysis/CMakeLists.txt | 1 | ||||
-rw-r--r-- | lib/Analysis/LazyValueInfo.cpp | 31 | ||||
-rw-r--r-- | test/Transforms/JumpThreading/basic.ll | 26 |
6 files changed, 108 insertions, 0 deletions
diff --git a/include/llvm/Analysis/LazyValueInfo.h b/include/llvm/Analysis/LazyValueInfo.h new file mode 100644 index 0000000000..29f8180959 --- /dev/null +++ b/include/llvm/Analysis/LazyValueInfo.h @@ -0,0 +1,43 @@ +//===- LazyValueInfo.h - Value constraint analysis --------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file defines the interface for lazy computation of value constraint +// information. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_ANALYSIS_LIVEVALUES_H +#define LLVM_ANALYSIS_LIVEVALUES_H + +#include "llvm/Pass.h" + +namespace llvm { + +/// LazyValueInfo - This pass computes, caches, and vends lazy value constraint +/// information. +class LazyValueInfo : public FunctionPass { +public: + static char ID; + LazyValueInfo(); + + virtual void getAnalysisUsage(AnalysisUsage &AU) const { + AU.setPreservesAll(); + } + virtual void releaseMemory(); + + virtual bool runOnFunction(Function &F) { + // Fully lazy. + return false; + } +}; + +} // end namespace llvm + +#endif + diff --git a/include/llvm/Analysis/Passes.h b/include/llvm/Analysis/Passes.h index 66ab3ea5ca..b222321225 100644 --- a/include/llvm/Analysis/Passes.h +++ b/include/llvm/Analysis/Passes.h @@ -139,6 +139,12 @@ namespace llvm { // createLiveValuesPass - This creates an instance of the LiveValues pass. // FunctionPass *createLiveValuesPass(); + + //===--------------------------------------------------------------------===// + // + /// createLazyValueInfoPass - This creates an instance of the LazyValueInfo + /// pass. + FunctionPass *createLazyValueInfoPass(); //===--------------------------------------------------------------------===// // diff --git a/include/llvm/LinkAllPasses.h b/include/llvm/LinkAllPasses.h index bcb98c16ad..c88e9540c9 100644 --- a/include/llvm/LinkAllPasses.h +++ b/include/llvm/LinkAllPasses.h @@ -82,6 +82,7 @@ namespace { (void) llvm::createInternalizePass(false); (void) llvm::createLCSSAPass(); (void) llvm::createLICMPass(); + (void) llvm::createLazyValueInfoPass(); (void) llvm::createLiveValuesPass(); (void) llvm::createLoopDependenceAnalysisPass(); (void) llvm::createLoopExtractorPass(); diff --git a/lib/Analysis/CMakeLists.txt b/lib/Analysis/CMakeLists.txt index 3f8356caf0..0a83c3db89 100644 --- a/lib/Analysis/CMakeLists.txt +++ b/lib/Analysis/CMakeLists.txt @@ -18,6 +18,7 @@ add_llvm_library(LLVMAnalysis InstructionSimplify.cpp Interval.cpp IntervalPartition.cpp + LazyValueInfo.cpp LibCallAliasAnalysis.cpp LibCallSemantics.cpp LiveValues.cpp diff --git a/lib/Analysis/LazyValueInfo.cpp b/lib/Analysis/LazyValueInfo.cpp new file mode 100644 index 0000000000..cfedc20448 --- /dev/null +++ b/lib/Analysis/LazyValueInfo.cpp @@ -0,0 +1,31 @@ +//===- LazyValueInfo.cpp - Value constraint analysis ----------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file defines the interface for lazy computation of value constraint +// information. +// +//===----------------------------------------------------------------------===// + +#include "llvm/Analysis/LazyValueInfo.h" +using namespace llvm; + +char LazyValueInfo::ID = 0; +static RegisterPass<LazyValueInfo> +X("lazy-value-info", "Lazy Value Information Analysis", false, true); + +namespace llvm { + FunctionPass *createLazyValueInfoPass() { return new LazyValueInfo(); } +} + +LazyValueInfo::LazyValueInfo() : FunctionPass(&ID) { +} + +void LazyValueInfo::releaseMemory() { + +} diff --git a/test/Transforms/JumpThreading/basic.ll b/test/Transforms/JumpThreading/basic.ll index c161a772f2..a2a9712754 100644 --- a/test/Transforms/JumpThreading/basic.ll +++ b/test/Transforms/JumpThreading/basic.ll @@ -284,3 +284,29 @@ F2: } + + +;;; Duplicate condition to avoid xor of cond. +define i32 @test10(i1 %cond, i1 %cond2) { +Entry: +; CHECK: @test10 + %v1 = call i32 @f1() + br i1 %cond, label %Merge, label %F1 + +F1: + br label %Merge + +Merge: + %B = phi i1 [true, %Entry], [%cond2, %F1] + %M = icmp eq i32 %v1, 192 + %N = xor i1 %B, %M + br i1 %N, label %T2, label %F2 + +T2: + ret i32 123 + +F2: + ret i32 %v1 +} + + |