1 ; RUN: opt < %s -basicaa -aa-eval -print-all-alias-modref-info -disable-output 2>&1 | FileCheck %s
2 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
3 target triple = "x86_64-unknown-linux-gnu"
5 ; CHECK-LABEL: test_with_zext
6 ; CHECK: NoAlias: i8* %a, i8* %b
8 define void @test_with_zext() {
9 %1 = tail call i8* @malloc(i64 120)
10 %a = getelementptr inbounds i8* %1, i64 8
11 %2 = getelementptr inbounds i8* %1, i64 16
12 %3 = zext i32 3 to i64
13 %b = getelementptr inbounds i8* %2, i64 %3
17 ; CHECK-LABEL: test_with_lshr
18 ; CHECK: NoAlias: i8* %a, i8* %b
20 define void @test_with_lshr(i64 %i) {
21 %1 = tail call i8* @malloc(i64 120)
22 %a = getelementptr inbounds i8* %1, i64 8
23 %2 = getelementptr inbounds i8* %1, i64 16
25 %b = getelementptr inbounds i8* %2, i64 %3
29 ; CHECK-LABEL: test_with_a_loop
30 ; CHECK: NoAlias: i8* %a, i8* %b
32 define void @test_with_a_loop() {
33 %1 = tail call i8* @malloc(i64 120)
34 %a = getelementptr inbounds i8* %1, i64 8
35 %2 = getelementptr inbounds i8* %1, i64 16
39 %i = phi i32 [ 0, %0 ], [ %i.next, %for.loop ]
40 %3 = zext i32 %i to i64
41 %b = getelementptr inbounds i8* %2, i64 %3
42 %i.next = add nuw nsw i32 %i, 1
43 %4 = icmp eq i32 %i.next, 10
44 br i1 %4, label %for.loop.exit, label %for.loop
50 ; CHECK-LABEL: test_sign_extension
51 ; CHECK: PartialAlias: i64* %b.i64, i8* %a
53 define void @test_sign_extension(i32 %p) {
54 %1 = tail call i8* @malloc(i64 120)
55 %p.64 = zext i32 %p to i64
56 %a = getelementptr inbounds i8* %1, i64 %p.64
57 %p.minus1 = add i32 %p, -1
58 %p.minus1.64 = zext i32 %p.minus1 to i64
59 %b.i8 = getelementptr inbounds i8* %1, i64 %p.minus1.64
60 %b.i64 = bitcast i8* %b.i8 to i64*
64 ; CHECK-LABEL: test_fe_tools
65 ; CHECK: PartialAlias: i32* %a, i32* %b
67 define void @test_fe_tools([8 x i32]* %values) {
71 %i = phi i32 [ 0, %reorder ], [ %i.next, %for.loop ]
72 %idxprom = zext i32 %i to i64
73 %b = getelementptr inbounds [8 x i32]* %values, i64 0, i64 %idxprom
74 %i.next = add nuw nsw i32 %i, 1
75 %1 = icmp eq i32 %i.next, 10
76 br i1 %1, label %for.loop.exit, label %for.loop
79 %a = getelementptr inbounds [8 x i32]* %values, i64 0, i64 1
86 ; Function Attrs: nounwind
87 declare noalias i8* @malloc(i64)