1 ; RUN: opt < %s -basicaa -dse -S | FileCheck %s
3 declare noalias i8* @calloc(i64, i64)
7 %1 = tail call noalias i8* @calloc(i64 1, i64 4)
8 %2 = bitcast i8* %1 to i32*
9 ; This store is dead and should be removed
10 store i32 0, i32* %2, align 4
11 ; CHECK-NOT: store i32 0, i32* %2, align 4
15 define i32* @test2() {
17 %1 = tail call noalias i8* @calloc(i64 1, i64 4)
18 %2 = bitcast i8* %1 to i32*
19 %3 = getelementptr i32, i32* %2, i32 5
20 store i32 0, i32* %3, align 4
21 ; CHECK-NOT: store i32 0, i32* %2, align 4
25 define i32* @test3(i32 *%arg) {
27 store i32 0, i32* %arg, align 4
28 ; CHECK: store i32 0, i32* %arg, align 4
32 declare void @clobber_memory(i8*)
35 %1 = tail call noalias i8* @calloc(i64 1, i64 4)
36 call void @clobber_memory(i8* %1)
37 store i8 0, i8* %1, align 4
38 ; CHECK: store i8 0, i8* %1, align 4
42 define i32* @test5() {
44 %1 = tail call noalias i8* @calloc(i64 1, i64 4)
45 %2 = bitcast i8* %1 to i32*
46 store volatile i32 0, i32* %2, align 4
47 ; CHECK: store volatile i32 0, i32* %2, align 4
53 %1 = tail call noalias i8* @calloc(i64 1, i64 4)
54 store i8 5, i8* %1, align 4
55 ; CHECK: store i8 5, i8* %1, align 4
59 define i8* @test7(i8 %arg) {
61 %1 = tail call noalias i8* @calloc(i64 1, i64 4)
62 store i8 %arg, i8* %1, align 4
63 ; CHECK: store i8 %arg, i8* %1, align 4