diff options
| author | Pete Cooper <peter_cooper@apple.com> | 2015-11-18 22:17:24 +0000 |
|---|---|---|
| committer | Pete Cooper <peter_cooper@apple.com> | 2015-11-18 22:17:24 +0000 |
| commit | 72bc23ef02bad3873d3572b2be529404a461d449 (patch) | |
| tree | f1a47c225592be2aa94fdcaf411d1d5f51a7c193 /llvm/test/DebugInfo | |
| parent | b035bd03e4db325de2380ea9263e10de5b9be3b6 (diff) | |
| download | bcm5719-llvm-72bc23ef02bad3873d3572b2be529404a461d449.tar.gz bcm5719-llvm-72bc23ef02bad3873d3572b2be529404a461d449.zip | |
Change memcpy/memset/memmove to have dest and source alignments.
Note, this was reviewed (and more details are in) http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20151109/312083.html
These intrinsics currently have an explicit alignment argument which is
required to be a constant integer. It represents the alignment of the
source and dest, and so must be the minimum of those.
This change allows source and dest to each have their own alignments
by using the alignment attribute on their arguments. The alignment
argument itself is removed.
There are a few places in the code for which the code needs to be
checked by an expert as to whether using only src/dest alignment is
safe. For those places, they currently take the minimum of src/dest
alignments which matches the current behaviour.
For example, code which used to read:
call void @llvm.memcpy.p0i8.p0i8.i32(i8* %dest, i8* %src, i32 500, i32 8, i1 false)
will now read:
call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 8 %dest, i8* align 8 %src, i32 500, i1 false)
For out of tree owners, I was able to strip alignment from calls using sed by replacing:
(call.*llvm\.memset.*)i32\ [0-9]*\,\ i1 false\)
with:
$1i1 false)
and similarly for memmove and memcpy.
I then added back in alignment to test cases which needed it.
A similar commit will be made to clang which actually has many differences in alignment as now
IRBuilder can generate different source/dest alignments on calls.
In IRBuilder itself, a new argument was added. Instead of calling:
CreateMemCpy(Dst, Src, getInt64(Size), DstAlign, /* isVolatile */ false)
you now call
CreateMemCpy(Dst, Src, getInt64(Size), DstAlign, SrcAlign, /* isVolatile */ false)
There is a temporary class (IntegerAlignment) which takes the source alignment and rejects
implicit conversion from bool. This is to prevent isVolatile here from passing its default
parameter to the source alignment.
Note, changes in future can now be made to codegen. I didn't change anything here, but this
change should enable better memcpy code sequences.
Reviewed by Hal Finkel.
llvm-svn: 253511
Diffstat (limited to 'llvm/test/DebugInfo')
| -rw-r--r-- | llvm/test/DebugInfo/AArch64/frameindices.ll | 10 | ||||
| -rw-r--r-- | llvm/test/DebugInfo/X86/array.ll | 4 | ||||
| -rw-r--r-- | llvm/test/DebugInfo/X86/array2.ll | 4 | ||||
| -rw-r--r-- | llvm/test/DebugInfo/X86/debug-ranges-offset.ll | 2 | ||||
| -rw-r--r-- | llvm/test/DebugInfo/X86/pieces-2.ll | 2 | ||||
| -rw-r--r-- | llvm/test/DebugInfo/X86/pieces-3.ll | 2 | ||||
| -rw-r--r-- | llvm/test/DebugInfo/X86/sroasplit-1.ll | 4 | ||||
| -rw-r--r-- | llvm/test/DebugInfo/X86/sroasplit-2.ll | 4 | ||||
| -rw-r--r-- | llvm/test/DebugInfo/X86/sroasplit-4.ll | 6 | ||||
| -rw-r--r-- | llvm/test/DebugInfo/X86/sroasplit-5.ll | 8 |
10 files changed, 23 insertions, 23 deletions
diff --git a/llvm/test/DebugInfo/AArch64/frameindices.ll b/llvm/test/DebugInfo/AArch64/frameindices.ll index 5fb03dfc883..a73fe7f3f13 100644 --- a/llvm/test/DebugInfo/AArch64/frameindices.ll +++ b/llvm/test/DebugInfo/AArch64/frameindices.ll @@ -51,7 +51,7 @@ entry: store i8* %call, i8** bitcast (i32** @b to i8**), align 8, !dbg !54, !tbaa !55 %1 = getelementptr inbounds %struct.A, %struct.A* %agg.tmp, i64 0, i32 0, !dbg !57 %2 = getelementptr inbounds %struct.A, %struct.A* %p1, i64 0, i32 0, !dbg !57 - call void @llvm.memcpy.p0i8.p0i8.i64(i8* %1, i8* %2, i64 24, i32 8, i1 false), !dbg !57, !tbaa.struct !58 + call void @llvm.memcpy.p0i8.p0i8.i64(i8* %1, i8* %2, i64 24, i1 false), !dbg !57, !tbaa.struct !58 call void @_Z2f91A(%struct.A* %agg.tmp), !dbg !61 ret void, !dbg !62 } @@ -65,7 +65,7 @@ declare noalias i8* @_Znwm(i64) #2 declare void @_Z2f91A(%struct.A*) #0 ; Function Attrs: nounwind -declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture readonly, i64, i32, i1) #3 +declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture readonly, i64, i1) #3 define void @_Z3f111A(%struct.A* nocapture readonly %p1) #0 !dbg !31 { entry: @@ -77,7 +77,7 @@ entry: %2 = load i64, i64* @a, align 8, !dbg !67, !tbaa !49 %call.i = tail call noalias i8* @_Znwm(i64 %2) #5, !dbg !68 store i8* %call.i, i8** bitcast (i32** @b to i8**), align 8, !dbg !69, !tbaa !55 - call void @llvm.memcpy.p0i8.p0i8.i64(i8* %1, i8* %0, i64 24, i32 8, i1 false), !dbg !70 + call void @llvm.memcpy.p0i8.p0i8.i64(i8* %1, i8* %0, i64 24, i1 false), !dbg !70 call void @_Z2f91A(%struct.A* %agg.tmp.i), !dbg !71 call void @llvm.lifetime.end(i64 24, i8* %1), !dbg !72 ret void, !dbg !73 @@ -112,11 +112,11 @@ call.i.i.noexc: ; preds = %entry store i8* %call.i.i5, i8** bitcast (i32** @b to i8**), align 8, !dbg !90, !tbaa !55 store i8 1, i8* %1, align 8, !dbg !91 %agg.tmp.sroa.2.0..sroa_raw_idx = getelementptr inbounds i8, i8* %1, i64 1, !dbg !91 - call void @llvm.memcpy.p0i8.p0i8.i64(i8* %agg.tmp.sroa.2.0..sroa_raw_idx, i8* %agg.tmp.sroa.2.1..sroa_idx, i64 15, i32 1, i1 false), !dbg !91 + call void @llvm.memcpy.p0i8.p0i8.i64(i8* %agg.tmp.sroa.2.0..sroa_raw_idx, i8* %agg.tmp.sroa.2.1..sroa_idx, i64 15, i1 false), !dbg !91 %agg.tmp.sroa.3.0..sroa_idx = getelementptr inbounds %struct.A, %struct.A* %agg.tmp.i.i, i64 0, i32 2, !dbg !91 store i8 1, i8* %agg.tmp.sroa.3.0..sroa_idx, align 8, !dbg !91 %agg.tmp.sroa.4.0..sroa_raw_idx = getelementptr inbounds i8, i8* %1, i64 17, !dbg !91 - call void @llvm.memcpy.p0i8.p0i8.i64(i8* %agg.tmp.sroa.4.0..sroa_raw_idx, i8* %agg.tmp.sroa.4.17..sroa_idx, i64 7, i32 1, i1 false), !dbg !91 + call void @llvm.memcpy.p0i8.p0i8.i64(i8* %agg.tmp.sroa.4.0..sroa_raw_idx, i8* %agg.tmp.sroa.4.17..sroa_idx, i64 7, i1 false), !dbg !91 invoke void @_Z2f91A(%struct.A* %agg.tmp.i.i) to label %invoke.cont unwind label %lpad, !dbg !92 diff --git a/llvm/test/DebugInfo/X86/array.ll b/llvm/test/DebugInfo/X86/array.ll index a50a44cfb95..d5da296386c 100644 --- a/llvm/test/DebugInfo/X86/array.ll +++ b/llvm/test/DebugInfo/X86/array.ll @@ -37,7 +37,7 @@ define i32 @main(i32 %argc, i8** nocapture readnone %argv) #0 !dbg !12 { tail call void @llvm.dbg.value(metadata i8** %argv, i64 0, metadata !20, metadata !DIExpression()), !dbg !35 tail call void @llvm.dbg.value(metadata [4 x i32]* %array, i64 0, metadata !21, metadata !DIExpression()), !dbg !36 %1 = bitcast [4 x i32]* %array to i8*, !dbg !36 - call void @llvm.memcpy.p0i8.p0i8.i64(i8* %1, i8* bitcast ([4 x i32]* @main.array to i8*), i64 16, i32 16, i1 false), !dbg !36 + call void @llvm.memcpy.p0i8.p0i8.i64(i8* %1, i8* bitcast ([4 x i32]* @main.array to i8*), i64 16, i1 false), !dbg !36 tail call void @llvm.dbg.value(metadata [4 x i32]* %array, i64 0, metadata !21, metadata !DIExpression()), !dbg !36 %2 = getelementptr inbounds [4 x i32], [4 x i32]* %array, i64 0, i64 0, !dbg !37 call void @f(i32* %2), !dbg !37 @@ -47,7 +47,7 @@ define i32 @main(i32 %argc, i8** nocapture readnone %argv) #0 !dbg !12 { } ; Function Attrs: nounwind -declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture readonly, i64, i32, i1) #1 +declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture readonly, i64, i1) #1 ; Function Attrs: nounwind readnone declare void @llvm.dbg.value(metadata, i64, metadata, metadata) #2 diff --git a/llvm/test/DebugInfo/X86/array2.ll b/llvm/test/DebugInfo/X86/array2.ll index f456aae2e25..330ce26a79e 100644 --- a/llvm/test/DebugInfo/X86/array2.ll +++ b/llvm/test/DebugInfo/X86/array2.ll @@ -53,7 +53,7 @@ entry: call void @llvm.dbg.declare(metadata i8*** %argv.addr, metadata !25, metadata !DIExpression()), !dbg !24 call void @llvm.dbg.declare(metadata [4 x i32]* %array, metadata !26, metadata !DIExpression()), !dbg !30 %0 = bitcast [4 x i32]* %array to i8*, !dbg !30 - call void @llvm.memcpy.p0i8.p0i8.i64(i8* %0, i8* bitcast ([4 x i32]* @main.array to i8*), i64 16, i32 16, i1 false), !dbg !30 + call void @llvm.memcpy.p0i8.p0i8.i64(i8* %0, i8* bitcast ([4 x i32]* @main.array to i8*), i64 16, i1 false), !dbg !30 %arraydecay = getelementptr inbounds [4 x i32], [4 x i32]* %array, i32 0, i32 0, !dbg !31 call void @f(i32* %arraydecay), !dbg !31 %arrayidx = getelementptr inbounds [4 x i32], [4 x i32]* %array, i32 0, i64 0, !dbg !32 @@ -62,7 +62,7 @@ entry: } ; Function Attrs: nounwind -declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture readonly, i64, i32, i1) #2 +declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture readonly, i64, i1) #2 attributes #0 = { nounwind ssp uwtable } attributes #1 = { nounwind readnone } diff --git a/llvm/test/DebugInfo/X86/debug-ranges-offset.ll b/llvm/test/DebugInfo/X86/debug-ranges-offset.ll index 520f3c45e18..5448f785bd2 100644 --- a/llvm/test/DebugInfo/X86/debug-ranges-offset.ll +++ b/llvm/test/DebugInfo/X86/debug-ranges-offset.ll @@ -190,7 +190,7 @@ declare i8* @__msan_memcpy(i8*, i8*, i64) declare i8* @__msan_memset(i8*, i32, i64) ; Function Attrs: nounwind -declare void @llvm.memset.p0i8.i64(i8* nocapture, i8, i64, i32, i1) #3 +declare void @llvm.memset.p0i8.i64(i8* nocapture, i8, i64, i1) #3 attributes #0 = { sanitize_memory uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" } attributes #1 = { nobuiltin "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" } diff --git a/llvm/test/DebugInfo/X86/pieces-2.ll b/llvm/test/DebugInfo/X86/pieces-2.ll index 8a43f452d32..15f9a3fbc82 100644 --- a/llvm/test/DebugInfo/X86/pieces-2.ll +++ b/llvm/test/DebugInfo/X86/pieces-2.ll @@ -44,7 +44,7 @@ entry: declare void @llvm.dbg.declare(metadata, metadata, metadata) #1 ; Function Attrs: nounwind -declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture readonly, i64, i32, i1) #2 +declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture readonly, i64, i1) #2 ; Function Attrs: nounwind readnone declare void @llvm.dbg.value(metadata, i64, metadata, metadata) #1 diff --git a/llvm/test/DebugInfo/X86/pieces-3.ll b/llvm/test/DebugInfo/X86/pieces-3.ll index d52748fc17f..18bcd34aa98 100644 --- a/llvm/test/DebugInfo/X86/pieces-3.ll +++ b/llvm/test/DebugInfo/X86/pieces-3.ll @@ -54,7 +54,7 @@ define i32 @foo(i64 %outer.coerce0, i64 %outer.coerce1) #0 !dbg !4 { declare void @llvm.dbg.declare(metadata, metadata, metadata) #1 ; Function Attrs: nounwind -declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture readonly, i64, i32, i1) #2 +declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture readonly, i64, i1) #2 ; Function Attrs: nounwind readnone declare void @llvm.dbg.value(metadata, i64, metadata, metadata) #1 diff --git a/llvm/test/DebugInfo/X86/sroasplit-1.ll b/llvm/test/DebugInfo/X86/sroasplit-1.ll index 11895a7f083..d6bf2d54eb5 100644 --- a/llvm/test/DebugInfo/X86/sroasplit-1.ll +++ b/llvm/test/DebugInfo/X86/sroasplit-1.ll @@ -45,7 +45,7 @@ entry: %arrayidx = getelementptr inbounds [2 x %struct.Inner], [2 x %struct.Inner]* %inner, i32 0, i64 1, !dbg !28 %0 = bitcast %struct.Inner* %i1 to i8*, !dbg !28 %1 = bitcast %struct.Inner* %arrayidx to i8*, !dbg !28 - call void @llvm.memcpy.p0i8.p0i8.i64(i8* %0, i8* %1, i64 16, i32 8, i1 false), !dbg !28 + call void @llvm.memcpy.p0i8.p0i8.i64(i8* %0, i8* %1, i64 16, i1 false), !dbg !28 %a = getelementptr inbounds %struct.Inner, %struct.Inner* %i1, i32 0, i32 0, !dbg !29 %2 = load i32, i32* %a, align 4, !dbg !29 ret i32 %2, !dbg !29 @@ -55,7 +55,7 @@ entry: declare void @llvm.dbg.declare(metadata, metadata, metadata) #1 ; Function Attrs: nounwind -declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture readonly, i64, i32, i1) #2 +declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture readonly, i64, i1) #2 attributes #0 = { nounwind ssp uwtable } attributes #1 = { nounwind readnone } diff --git a/llvm/test/DebugInfo/X86/sroasplit-2.ll b/llvm/test/DebugInfo/X86/sroasplit-2.ll index bea1b26df28..76929a5679d 100644 --- a/llvm/test/DebugInfo/X86/sroasplit-2.ll +++ b/llvm/test/DebugInfo/X86/sroasplit-2.ll @@ -51,7 +51,7 @@ define i32 @foo(i64 %outer.coerce0, i64 %outer.coerce1) #0 !dbg !4 { %5 = getelementptr inbounds [2 x %struct.Inner], [2 x %struct.Inner]* %4, i32 0, i64 1, !dbg !27 %6 = bitcast %struct.Inner* %i1 to i8*, !dbg !27 %7 = bitcast %struct.Inner* %5 to i8*, !dbg !27 - call void @llvm.memcpy.p0i8.p0i8.i64(i8* %6, i8* %7, i64 8, i32 4, i1 false), !dbg !27 + call void @llvm.memcpy.p0i8.p0i8.i64(i8* %6, i8* %7, i64 8, i1 false), !dbg !27 %8 = getelementptr inbounds %struct.Inner, %struct.Inner* %i1, i32 0, i32 0, !dbg !28 %9 = load i32, i32* %8, align 4, !dbg !28 ret i32 %9, !dbg !28 @@ -61,7 +61,7 @@ define i32 @foo(i64 %outer.coerce0, i64 %outer.coerce1) #0 !dbg !4 { declare void @llvm.dbg.declare(metadata, metadata, metadata) #1 ; Function Attrs: nounwind -declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture readonly, i64, i32, i1) #2 +declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture readonly, i64, i1) #2 attributes #0 = { nounwind ssp uwtable "no-frame-pointer-elim"="true" } attributes #1 = { nounwind readnone } diff --git a/llvm/test/DebugInfo/X86/sroasplit-4.ll b/llvm/test/DebugInfo/X86/sroasplit-4.ll index 2abf6e1ec9b..2b1ca2fd156 100644 --- a/llvm/test/DebugInfo/X86/sroasplit-4.ll +++ b/llvm/test/DebugInfo/X86/sroasplit-4.ll @@ -78,10 +78,10 @@ if.end: ; preds = %entry %y3 = getelementptr inbounds %struct.r, %struct.r* %r, i32 0, i32 2, !dbg !32 %2 = bitcast %struct.p* %y3 to i8*, !dbg !32 %3 = bitcast %struct.p* %y to i8*, !dbg !32 - call void @llvm.memcpy.p0i8.p0i8.i64(i8* %2, i8* %3, i64 16, i32 8, i1 false), !dbg !32 + call void @llvm.memcpy.p0i8.p0i8.i64(i8* %2, i8* %3, i64 16, i1 false), !dbg !32 %4 = bitcast %struct.r* %agg.tmp to i8*, !dbg !33 %5 = bitcast %struct.r* %r to i8*, !dbg !33 - call void @llvm.memcpy.p0i8.p0i8.i64(i8* %4, i8* %5, i64 40, i32 8, i1 false), !dbg !33 + call void @llvm.memcpy.p0i8.p0i8.i64(i8* %4, i8* %5, i64 40, i1 false), !dbg !33 %call4 = call i32 @_Z7call_me1r(%struct.r* byval align 8 %agg.tmp), !dbg !33 store i32 %call4, i32* %retval, !dbg !33 br label %return, !dbg !33 @@ -97,7 +97,7 @@ declare i32 @_Z5maybev() declare void @llvm.dbg.declare(metadata, metadata, metadata) #2 ; Function Attrs: nounwind -declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture readonly, i64, i32, i1) #3 +declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture readonly, i64, i1) #3 declare i32 @_Z7call_me1r(%struct.r* byval align 8) diff --git a/llvm/test/DebugInfo/X86/sroasplit-5.ll b/llvm/test/DebugInfo/X86/sroasplit-5.ll index 059cb19e92e..01b0416083c 100644 --- a/llvm/test/DebugInfo/X86/sroasplit-5.ll +++ b/llvm/test/DebugInfo/X86/sroasplit-5.ll @@ -34,7 +34,7 @@ entry: %local = alloca i32, align 4 call void @llvm.dbg.declare(metadata %struct.prog_src_register* %a, metadata !16, metadata !17), !dbg !18 %0 = bitcast %struct.prog_src_register* %a to i8*, !dbg !19 - call void @llvm.memset.p0i8.i64(i8* %0, i8 0, i64 8, i32 4, i1 false), !dbg !19 + call void @llvm.memset.p0i8.i64(i8* %0, i8 0, i64 8, i1 false), !dbg !19 call void @llvm.dbg.declare(metadata i32* %local, metadata !20, metadata !17), !dbg !21 %1 = bitcast %struct.prog_src_register* %a to i32*, !dbg !21 %bf.load = load i32, i32* %1, align 4, !dbg !21 @@ -43,7 +43,7 @@ entry: store i32 %bf.ashr, i32* %local, align 4, !dbg !21 %2 = bitcast %struct.prog_src_register* %retval to i8*, !dbg !22 %3 = bitcast %struct.prog_src_register* %a to i8*, !dbg !22 - call void @llvm.memcpy.p0i8.p0i8.i64(i8* %2, i8* %3, i64 8, i32 4, i1 false), !dbg !22 + call void @llvm.memcpy.p0i8.p0i8.i64(i8* %2, i8* %3, i64 8, i1 false), !dbg !22 %4 = bitcast %struct.prog_src_register* %retval to i64*, !dbg !22 %5 = load i64, i64* %4, align 1, !dbg !22 ret i64 %5, !dbg !22 @@ -53,10 +53,10 @@ entry: declare void @llvm.dbg.declare(metadata, metadata, metadata) #1 ; Function Attrs: nounwind -declare void @llvm.memset.p0i8.i64(i8* nocapture, i8, i64, i32, i1) #2 +declare void @llvm.memset.p0i8.i64(i8* nocapture, i8, i64, i1) #2 ; Function Attrs: nounwind -declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture readonly, i64, i32, i1) #2 +declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture readonly, i64, i1) #2 attributes #0 = { nounwind } attributes #1 = { nounwind readnone } |

