aboutsummaryrefslogtreecommitdiffstats
path: root/include/llvm/Analysis/ScalarEvolution.h
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-12-26 23:42:51 +0000
committerChris Lattner <sabre@nondot.org>2010-12-26 23:42:51 +0000
commita92ff91a967c63a2395a34c9e8331a7d50d6ab10 (patch)
tree742fb55b9aed958aafb122dfe55b0b138c815f31 /include/llvm/Analysis/ScalarEvolution.h
parent61db1f56d0b717d67557bbb2a9d83af1449458cb (diff)
downloadexternal_llvm-a92ff91a967c63a2395a34c9e8331a7d50d6ab10.zip
external_llvm-a92ff91a967c63a2395a34c9e8331a7d50d6ab10.tar.gz
external_llvm-a92ff91a967c63a2395a34c9e8331a7d50d6ab10.tar.bz2
implement enough of the memset inference algorithm to recognize and insert
memsets. This is still missing one important validity check, but this is enough to compile stuff like this: void test0(std::vector<char> &X) { for (std::vector<char>::iterator I = X.begin(), E = X.end(); I != E; ++I) *I = 0; } void test1(std::vector<int> &X) { for (long i = 0, e = X.size(); i != e; ++i) X[i] = 0x01010101; } With: $ clang t.cpp -S -o - -O2 -emit-llvm | opt -loop-idiom | opt -O3 | llc to: __Z5test0RSt6vectorIcSaIcEE: ## @_Z5test0RSt6vectorIcSaIcEE ## BB#0: ## %entry subq $8, %rsp movq (%rdi), %rax movq 8(%rdi), %rsi cmpq %rsi, %rax je LBB0_2 ## BB#1: ## %bb.nph subq %rax, %rsi movq %rax, %rdi callq ___bzero LBB0_2: ## %for.end addq $8, %rsp ret ... __Z5test1RSt6vectorIiSaIiEE: ## @_Z5test1RSt6vectorIiSaIiEE ## BB#0: ## %entry subq $8, %rsp movq (%rdi), %rax movq 8(%rdi), %rdx subq %rax, %rdx cmpq $4, %rdx jb LBB1_2 ## BB#1: ## %for.body.preheader andq $-4, %rdx movl $1, %esi movq %rax, %rdi callq _memset LBB1_2: ## %for.end addq $8, %rsp ret git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122573 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Analysis/ScalarEvolution.h')
-rw-r--r--include/llvm/Analysis/ScalarEvolution.h3
1 files changed, 1 insertions, 2 deletions
diff --git a/include/llvm/Analysis/ScalarEvolution.h b/include/llvm/Analysis/ScalarEvolution.h
index 38c50d1..d910406 100644
--- a/include/llvm/Analysis/ScalarEvolution.h
+++ b/include/llvm/Analysis/ScalarEvolution.h
@@ -539,8 +539,7 @@ namespace llvm {
/// getMinusSCEV - Return LHS-RHS.
///
- const SCEV *getMinusSCEV(const SCEV *LHS,
- const SCEV *RHS);
+ const SCEV *getMinusSCEV(const SCEV *LHS, const SCEV *RHS);
/// getTruncateOrZeroExtend - Return a SCEV corresponding to a conversion
/// of the input value to the specified type. If the type must be