|
| 1 | +; RUN: opt -inferattrs -basic-aa -aa-eval -print-all-alias-modref-info -disable-output 2>&1 %s | FileCheck %s |
| 2 | + |
| 3 | +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" |
| 4 | +target triple = "x86_64-apple-macosx10.7" |
| 5 | + |
| 6 | +; CHECK-LABEL: Function: test_memcmp_const_size |
| 7 | +; CHECK: Just Ref: Ptr: i8* %a <-> %res = tail call i32 @memcmp(i8* %a, i8* %b, i64 4) |
| 8 | +; CHECK-NEXT: Just Ref: Ptr: i8* %b <-> %res = tail call i32 @memcmp(i8* %a, i8* %b, i64 4) |
| 9 | +; CHECK-NEXT: Just Ref: Ptr: i8* %a.gep.1 <-> %res = tail call i32 @memcmp(i8* %a, i8* %b, i64 4) |
| 10 | +; CHECK-NEXT: Just Ref: Ptr: i8* %a.gep.5 <-> %res = tail call i32 @memcmp(i8* %a, i8* %b, i64 4) |
| 11 | +; CHECK-NEXT: Just Ref: Ptr: i8* %b.gep.1 <-> %res = tail call i32 @memcmp(i8* %a, i8* %b, i64 4) |
| 12 | +; CHECK-NEXT: Just Ref: Ptr: i8* %b.gep.5 <-> %res = tail call i32 @memcmp(i8* %a, i8* %b, i64 4) |
| 13 | +define i32 @test_memcmp_const_size(i8* noalias %a, i8* noalias %b) { |
| 14 | +entry: |
| 15 | + %res = tail call i32 @memcmp(i8* %a, i8* %b, i64 4) |
| 16 | + %a.gep.1 = getelementptr i8, i8* %a, i32 1 |
| 17 | + store i8 0, i8* %a.gep.1 |
| 18 | + %a.gep.5 = getelementptr i8, i8* %a, i32 5 |
| 19 | + store i8 1, i8* %a.gep.5 |
| 20 | + %b.gep.1 = getelementptr i8, i8* %b, i32 1 |
| 21 | + store i8 2, i8* %b.gep.1 |
| 22 | + %b.gep.5 = getelementptr i8, i8* %b, i32 5 |
| 23 | + store i8 3, i8* %b.gep.5 |
| 24 | + ret i32 %res |
| 25 | +} |
| 26 | + |
| 27 | +; CHECK-LABEL: Function: test_memcmp_variable_size |
| 28 | +; CHECK: Just Ref: Ptr: i8* %a <-> %res = tail call i32 @memcmp(i8* %a, i8* %b, i64 %n) |
| 29 | +; CHECK-NEXT: Just Ref: Ptr: i8* %b <-> %res = tail call i32 @memcmp(i8* %a, i8* %b, i64 %n) |
| 30 | +; CHECK-NEXT: Just Ref: Ptr: i8* %a.gep.1 <-> %res = tail call i32 @memcmp(i8* %a, i8* %b, i64 %n) |
| 31 | +; CHECK-NEXT: Just Ref: Ptr: i8* %a.gep.5 <-> %res = tail call i32 @memcmp(i8* %a, i8* %b, i64 %n) |
| 32 | +; CHECK-NEXT: Just Ref: Ptr: i8* %b.gep.1 <-> %res = tail call i32 @memcmp(i8* %a, i8* %b, i64 %n) |
| 33 | +; CHECK-NEXT: Just Ref: Ptr: i8* %b.gep.5 <-> %res = tail call i32 @memcmp(i8* %a, i8* %b, i64 %n) |
| 34 | +define i32 @test_memcmp_variable_size(i8* noalias %a, i8* noalias %b, i64 %n) { |
| 35 | +entry: |
| 36 | + %res = tail call i32 @memcmp(i8* %a, i8* %b, i64 %n) |
| 37 | + %a.gep.1 = getelementptr i8, i8* %a, i32 1 |
| 38 | + store i8 0, i8* %a.gep.1 |
| 39 | + %a.gep.5 = getelementptr i8, i8* %a, i32 5 |
| 40 | + store i8 1, i8* %a.gep.5 |
| 41 | + %b.gep.1 = getelementptr i8, i8* %b, i32 1 |
| 42 | + store i8 2, i8* %b.gep.1 |
| 43 | + %b.gep.5 = getelementptr i8, i8* %b, i32 5 |
| 44 | + store i8 3, i8* %b.gep.5 |
| 45 | + ret i32 %res |
| 46 | +} |
| 47 | + |
| 48 | + |
| 49 | +declare i32 @memcmp(i8*, i8*, i64) |
0 commit comments