1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 11:02:59 +02:00
llvm-mirror/test/CodeGen/XCore
Pete Cooper aca4c5cdc6 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
2015-11-18 22:17:24 +00:00
..
2008-11-17-Shl64.ll
2009-01-08-Crash.ll
2009-01-14-Remat-Crash.ll
2009-03-27-v2f64-param.ll
2009-07-15-store192.ll
2010-02-25-LSR-Crash.ll
2011-01-31-DAGCombineBug.ll
2011-08-01-DynamicAllocBug.ll
addsub64.ll
aliases.ll [opaque pointer type] Add textual IR support for explicit type parameter for global aliases 2015-09-11 03:22:04 +00:00
align.ll
alignment.ll
ashr.ll
atomic.ll
basictest.ll
bigstructret.ll
byVal.ll
call.ll
codemodel.ll
constants.ll
DbgValueOtherTargets.test
dwarf_debug.ll DI: Reverse direction of subprogram -> function edge. 2015-11-05 22:03:56 +00:00
epilogue_prologue.ll
events.ll
exception.ll Move the personality function from LandingPadInst to Function 2015-06-17 20:52:32 +00:00
float-intrinsics.ll
fneg.ll
getid.ll
globals.ll
indirectbr.ll
inline-asm.ll
ladd_lsub_combine.ll
licm-ldwcp.ll
linkage.ll
lit.local.cfg
llvm-intrinsics.ll [opaque pointer type] Add textual IR support for explicit type parameter to the call instruction 2015-04-16 23:24:18 +00:00
load.ll
memcpy.ll Change memcpy/memset/memmove to have dest and source alignments. 2015-11-18 22:17:24 +00:00
misc-intrinsics.ll
mkmsk.ll
mul64.ll
offset_folding.ll
private.ll
ps-intrinsics.ll
resources_combine.ll
resources.ll
scavenging.ll
sext.ll
shedulingPreference.ll
sr-intrinsics.ll
store.ll
switch_long.ll
switch.ll
threads.ll
tls.ll
trampoline.ll
trap.ll
unaligned_load.ll
unaligned_store_combine.ll
unaligned_store.ll
varargs.ll
zext.ll
zextfree.ll