diff options
author | Chris Lattner <sabre@nondot.org> | 2011-02-19 19:56:44 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2011-02-19 19:56:44 +0000 |
commit | 80e8b506b8134d63dc3cb6211cccc34be4b19d40 (patch) | |
tree | 21ebd657abbe2afd75135ee6ce91e24e7e2e55a1 /test/Transforms/LoopIdiom | |
parent | 41bfbb0a8776674c486682cbf2aa80f15abfef68 (diff) |
rewrite the memset_pattern pattern generation stuff to accept any 2/4/8/16-byte
constant, including globals. This makes us generate much more "pretty" pattern
globals as well because it doesn't break it down to an array of bytes all the
time.
This enables us to handle stores of relocatable globals. This kicks in about
48 times in 254.gap, giving us stuff like this:
@.memset_pattern40 = internal constant [2 x %struct.TypHeader* (%struct.TypHeader*, %struct.TypHeader*)*] [%struct.TypHeader* (%struct.TypHeader*, %struct
.TypHeader*)* @IsFalse, %struct.TypHeader* (%struct.TypHeader*, %struct.TypHeader*)* @IsFalse], align 16
...
call void @memset_pattern16(i8* %scevgep5859, i8* bitcast ([2 x %struct.TypHeader* (%struct.TypHeader*, %struct.TypHeader*)*]* @.memset_pattern40 to i8*
), i64 %tmp75) nounwind
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126044 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/LoopIdiom')
-rw-r--r-- | test/Transforms/LoopIdiom/basic.ll | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/test/Transforms/LoopIdiom/basic.ll b/test/Transforms/LoopIdiom/basic.ll index 122d25a22a..485114c8d4 100644 --- a/test/Transforms/LoopIdiom/basic.ll +++ b/test/Transforms/LoopIdiom/basic.ll @@ -277,7 +277,7 @@ for.end13: ; preds = %for.inc10 ; On darwin10 (which is the triple in this .ll file) this loop can be turned ; into a memset_pattern call. ; rdar://9009151 -define void @test11(i32* nocapture %P) nounwind ssp { +define void @test11_pattern(i32* nocapture %P) nounwind ssp { entry: br label %for.body @@ -291,7 +291,7 @@ for.body: ; preds = %entry, %for.body for.end: ; preds = %for.body ret void -; CHECK: @test11 +; CHECK: @test11_pattern ; CHECK-NEXT: entry: ; CHECK-NEXT: bitcast ; CHECK-NEXT: memset_pattern @@ -322,3 +322,28 @@ for.end: ; preds = %for.body ; CHECK: ret void } +@G = global i32 5 + +; This store-of-address loop can be turned into a memset_pattern call. +; rdar://9009151 +define void @test13_pattern(i32** nocapture %P) nounwind ssp { +entry: + br label %for.body + +for.body: ; preds = %entry, %for.body + %indvar = phi i64 [ 0, %entry ], [ %indvar.next, %for.body ] + %arrayidx = getelementptr i32** %P, i64 %indvar + store i32* @G, i32** %arrayidx, align 4 + %indvar.next = add i64 %indvar, 1 + %exitcond = icmp eq i64 %indvar.next, 10000 + br i1 %exitcond, label %for.end, label %for.body + +for.end: ; preds = %for.body + ret void +; CHECK: @test13_pattern +; CHECK-NEXT: entry: +; CHECK-NEXT: bitcast +; CHECK-NEXT: memset_pattern +; CHECK-NOT: store +; CHECK: ret void +} |