xref: /llvm-project/llvm/test/Analysis/BasicAA/assume.ll (revision 303c308e452c703c3d47940383ded3b2d3eefd56)
1; RUN: opt < %s -aa-pipeline=basic-aa -passes=aa-eval -print-all-alias-modref-info -disable-output 2>&1 | FileCheck %s
2target datalayout = "e-p:32:32:32-i1:8:32-i8:8:32-i16:16:32-i32:32:32-i64:32:32-f32:32:32-f64:32:32-v64:32:64-v128:32:128-a0:0:32-n32"
3
4declare void @llvm.memcpy.p0.p0.i64(ptr nocapture, ptr nocapture, i64, i1) #0
5declare void @llvm.assume(i1) #0
6
7define void @test1(ptr %P, ptr %Q) nounwind ssp {
8  tail call void @llvm.assume(i1 true)
9  tail call void @llvm.memcpy.p0.p0.i64(ptr %P, ptr %Q, i64 12, i1 false)
10  load i8, ptr %P
11  load i8, ptr %Q
12  ret void
13
14; CHECK-LABEL: Function: test1:
15
16; CHECK: MayAlias:	i8* %P, i8* %Q
17; CHECK: NoModRef:  Ptr: i8* %P	<->  tail call void @llvm.assume(i1 true)
18; CHECK: NoModRef:  Ptr: i8* %Q	<->  tail call void @llvm.assume(i1 true)
19; CHECK: Both ModRef:  Ptr: i8* %P	<->  tail call void @llvm.memcpy.p0.p0.i64(ptr %P, ptr %Q, i64 12, i1 false)
20; CHECK: Both ModRef:  Ptr: i8* %Q	<->  tail call void @llvm.memcpy.p0.p0.i64(ptr %P, ptr %Q, i64 12, i1 false)
21; CHECK: NoModRef:   tail call void @llvm.assume(i1 true) <->   tail call void @llvm.memcpy.p0.p0.i64(ptr %P, ptr %Q, i64 12, i1 false)
22; CHECK: NoModRef:   tail call void @llvm.memcpy.p0.p0.i64(ptr %P, ptr %Q, i64 12, i1 false) <->   tail call void @llvm.assume(i1 true)
23}
24
25; Same but with operand bundles
26define void @test2(ptr %P, ptr %Q) nounwind ssp {
27  tail call void @llvm.assume(i1 true) [ "nonnull"(ptr %P) ]
28  tail call void @llvm.memcpy.p0.p0.i64(ptr %P, ptr %Q, i64 12, i1 false)
29  load i8, ptr %P
30  load i8, ptr %Q
31  ret void
32
33; CHECK-LABEL: Function: test2:
34
35; CHECK: MayAlias:	i8* %P, i8* %Q
36; CHECK: NoModRef:  Ptr: i8* %P	<->  tail call void @llvm.assume(i1 true) [ "nonnull"(ptr %P) ]
37; CHECK: NoModRef:  Ptr: i8* %Q	<->  tail call void @llvm.assume(i1 true) [ "nonnull"(ptr %P) ]
38; CHECK: Both ModRef:  Ptr: i8* %P	<->  tail call void @llvm.memcpy.p0.p0.i64(ptr %P, ptr %Q, i64 12, i1 false)
39; CHECK: Both ModRef:  Ptr: i8* %Q	<->  tail call void @llvm.memcpy.p0.p0.i64(ptr %P, ptr %Q, i64 12, i1 false)
40; CHECK: NoModRef:   tail call void @llvm.assume(i1 true) [ "nonnull"(ptr %P) ] <->   tail call void @llvm.memcpy.p0.p0.i64(ptr %P, ptr %Q, i64 12, i1 false)
41; CHECK: NoModRef:   tail call void @llvm.memcpy.p0.p0.i64(ptr %P, ptr %Q, i64 12, i1 false) <->   tail call void @llvm.assume(i1 true) [ "nonnull"(ptr %P) ]
42}
43
44attributes #0 = { nounwind }
45