llvm.org GIT mirror llvm / cbc5616
[BasicAA] Teach the analysis about atomic memcpy Summary: A simple change to derive mod/ref info from the atomic memcpy intrinsic in the same way as from the regular memcpy intrinsic. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@333454 91177308-0d34-0410-b5e6-96231b3b80d8 Daniel Neilson 2 years ago
2 changed file(s) with 18 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
887887 // operands, i.e., source and destination of any given memcpy must no-alias.
888888 // If Loc must-aliases either one of these two locations, then it necessarily
889889 // no-aliases the other.
890 if (auto *Inst = dyn_cast<MemCpyInst>(CS.getInstruction())) {
890 if (auto *Inst = dyn_cast<AnyMemCpyInst>(CS.getInstruction())) {
891891 AliasResult SrcAA, DestAA;
892892
893893 if ((SrcAA = getBestAAResults().alias(MemoryLocation::getForSource(Inst),
33
44 declare void @llvm.memset.p0i8.i64(i8* nocapture writeonly, i8, i64, i1) #0
55 declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture writeonly, i8* nocapture readonly, i64, i1) #0
6 declare void @llvm.memcpy.element.unordered.atomic.p0i8.p0i8.i64(i8* nocapture writeonly, i8* nocapture readonly, i64, i32) #0
67
78 declare void @a_readonly_func(i8*) #1
89 declare void @a_writeonly_func(i8*) #2
2122 ; CHECK: Just Ref: Ptr: i8* %Q <-> tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* %P, i8* %Q, i64 12, i1 false)
2223 ; CHECK: Just Mod: tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* %P, i8* %Q, i64 12, i1 false) <-> tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* %P, i8* %Q, i64 12, i1 false)
2324 ; CHECK: Just Mod: tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* %P, i8* %Q, i64 12, i1 false) <-> tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* %P, i8* %Q, i64 12, i1 false)
25 }
26
27 define void @test2_atomic(i8* %P, i8* %Q) #3 {
28 tail call void @llvm.memcpy.element.unordered.atomic.p0i8.p0i8.i64(i8* align 1 %P, i8* align 1 %Q, i64 12, i32 1)
29 tail call void @llvm.memcpy.element.unordered.atomic.p0i8.p0i8.i64(i8* align 1 %P, i8* align 1 %Q, i64 12, i32 1)
30 ret void
31
32 ; CHECK-LABEL: Function: test2_atomic:
33
34 ; CHECK: MayAlias: i8* %P, i8* %Q
35 ; CHECK: Just Mod: Ptr: i8* %P <-> tail call void @llvm.memcpy.element.unordered.atomic.p0i8.p0i8.i64(i8* align 1 %P, i8* align 1 %Q, i64 12, i32 1)
36 ; CHECK: Just Ref: Ptr: i8* %Q <-> tail call void @llvm.memcpy.element.unordered.atomic.p0i8.p0i8.i64(i8* align 1 %P, i8* align 1 %Q, i64 12, i32 1)
37 ; CHECK: Just Mod: Ptr: i8* %P <-> tail call void @llvm.memcpy.element.unordered.atomic.p0i8.p0i8.i64(i8* align 1 %P, i8* align 1 %Q, i64 12, i32 1)
38 ; CHECK: Just Ref: Ptr: i8* %Q <-> tail call void @llvm.memcpy.element.unordered.atomic.p0i8.p0i8.i64(i8* align 1 %P, i8* align 1 %Q, i64 12, i32 1)
39 ; CHECK: Just Mod: tail call void @llvm.memcpy.element.unordered.atomic.p0i8.p0i8.i64(i8* align 1 %P, i8* align 1 %Q, i64 12, i32 1) <-> tail call void @llvm.memcpy.element.unordered.atomic.p0i8.p0i8.i64(i8* align 1 %P, i8* align 1 %Q, i64 12, i32 1)
40 ; CHECK: Just Mod: tail call void @llvm.memcpy.element.unordered.atomic.p0i8.p0i8.i64(i8* align 1 %P, i8* align 1 %Q, i64 12, i32 1) <-> tail call void @llvm.memcpy.element.unordered.atomic.p0i8.p0i8.i64(i8* align 1 %P, i8* align 1 %Q, i64 12, i32 1)
2441 }
2542
2643 define void @test2a(i8* noalias %P, i8* noalias %Q) #3 {