mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2026-04-25 05:22:04 +00:00
Merge memsets followed by neighboring memsets and other stores into
larger memsets. Among other things, this fixes rdar://8760394 and allows us to handle "Example 2" from http://blog.regehr.org/archives/320, compiling it into a single 4096-byte memset: _mad_synth_mute: ## @mad_synth_mute ## BB#0: ## %entry pushq %rax movl $4096, %esi ## imm = 0x1000 callq ___bzero popq %rax ret git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123089 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -164,6 +164,7 @@ entry:
|
||||
declare void @foo(%struct.MV*, %struct.MV*, i8*)
|
||||
|
||||
|
||||
; Store followed by memset.
|
||||
define void @test3(i32* nocapture %P) nounwind ssp {
|
||||
entry:
|
||||
%arrayidx = getelementptr inbounds i32* %P, i64 1
|
||||
@@ -177,6 +178,7 @@ entry:
|
||||
; CHECK: call void @llvm.memset.p0i8.i64(i8* %1, i8 0, i64 15, i32 4, i1 false)
|
||||
}
|
||||
|
||||
; store followed by memset, different offset scenario
|
||||
define void @test4(i32* nocapture %P) nounwind ssp {
|
||||
entry:
|
||||
store i32 0, i32* %P, align 4
|
||||
@@ -191,4 +193,30 @@ entry:
|
||||
|
||||
declare void @llvm.memset.p0i8.i64(i8* nocapture, i8, i64, i32, i1) nounwind
|
||||
|
||||
; Memset followed by store.
|
||||
define void @test5(i32* nocapture %P) nounwind ssp {
|
||||
entry:
|
||||
%add.ptr = getelementptr inbounds i32* %P, i64 2
|
||||
%0 = bitcast i32* %add.ptr to i8*
|
||||
tail call void @llvm.memset.p0i8.i64(i8* %0, i8 0, i64 11, i32 1, i1 false)
|
||||
%arrayidx = getelementptr inbounds i32* %P, i64 1
|
||||
store i32 0, i32* %arrayidx, align 4
|
||||
ret void
|
||||
; CHECK: @test5
|
||||
; CHECK-NOT: store
|
||||
; CHECK: call void @llvm.memset.p0i8.i64(i8* %1, i8 0, i64 15, i32 4, i1 false)
|
||||
}
|
||||
|
||||
;; Memset followed by memset.
|
||||
define void @test6(i32* nocapture %P) nounwind ssp {
|
||||
entry:
|
||||
%0 = bitcast i32* %P to i8*
|
||||
tail call void @llvm.memset.p0i8.i64(i8* %0, i8 0, i64 12, i32 1, i1 false)
|
||||
%add.ptr = getelementptr inbounds i32* %P, i64 3
|
||||
%1 = bitcast i32* %add.ptr to i8*
|
||||
tail call void @llvm.memset.p0i8.i64(i8* %1, i8 0, i64 12, i32 1, i1 false)
|
||||
ret void
|
||||
; CHECK: @test6
|
||||
; CHECK: call void @llvm.memset.p0i8.i64(i8* %2, i8 0, i64 24, i32 1, i1 false)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user