diff options
author | Chris Lattner <sabre@nondot.org> | 2011-01-01 19:54:22 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2011-01-01 19:54:22 +0000 |
commit | a64cbf067d6315522d13b606774bbadb4e328d1b (patch) | |
tree | 162d734fcc137ce72e22181f4e470bfc13801a17 /test/Transforms/LoopIdiom | |
parent | 30980b68151a1c1527306aa0f39e3b297af05583 (diff) | |
download | external_llvm-a64cbf067d6315522d13b606774bbadb4e328d1b.zip external_llvm-a64cbf067d6315522d13b606774bbadb4e328d1b.tar.gz external_llvm-a64cbf067d6315522d13b606774bbadb4e328d1b.tar.bz2 |
improve validity check to handle constant-trip-count loops more
aggressively. In practice, this doesn't help anything though,
see the todo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122660 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/LoopIdiom')
-rw-r--r-- | test/Transforms/LoopIdiom/basic.ll | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/test/Transforms/LoopIdiom/basic.ll b/test/Transforms/LoopIdiom/basic.ll index 7f96b3c..ef37b1d 100644 --- a/test/Transforms/LoopIdiom/basic.ll +++ b/test/Transforms/LoopIdiom/basic.ll @@ -1,4 +1,4 @@ -; RUN: opt -loop-idiom < %s -S | FileCheck %s +; RUN: opt -basicaa -loop-idiom < %s -S | FileCheck %s target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64" target triple = "x86_64-apple-darwin10.0.0" @@ -65,3 +65,29 @@ for.end: ; preds = %entry ; CHECK-NOT: memset ; CHECK: ret void } + + +;; TODO: We should be able to promote this memset. Not yet though. +define void @test4(i8* %Base) nounwind ssp { +bb.nph: ; preds = %entry + %Base100 = getelementptr i8* %Base, i64 1000 + br label %for.body + +for.body: ; preds = %bb.nph, %for.body + %indvar = phi i64 [ 0, %bb.nph ], [ %indvar.next, %for.body ] + %I.0.014 = getelementptr i8* %Base, i64 %indvar + store i8 0, i8* %I.0.014, align 1 + + ;; Store beyond the range memset, should be safe to promote. + store i8 42, i8* %Base100 + + %indvar.next = add i64 %indvar, 1 + %exitcond = icmp eq i64 %indvar.next, 100 + br i1 %exitcond, label %for.end, label %for.body + +for.end: ; preds = %for.body, %entry + ret void +; CHECK-TODO: @test4 +; CHECK-TODO: call void @llvm.memset.p0i8.i64(i8* %Base, i8 0, i64 100, i32 1, i1 false) +; CHECK-TODO-NOT: store +} |