• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2; RUN: opt < %s -basic-aa -dse -S | FileCheck %s
3; RUN: opt < %s -aa-pipeline=basic-aa -passes=dse -S | FileCheck %s
4
5declare void @use(i64*)
6
7define void @test1() {
8; CHECK-LABEL: @test1(
9; CHECK-NEXT:    [[A:%.*]] = alloca i64
10; CHECK-NEXT:    call void @use(i64* [[A]])
11; CHECK-NEXT:    [[PTR1:%.*]] = bitcast i64* [[A]] to i8*
12; CHECK-NEXT:    [[PTR2:%.*]] = getelementptr i8, i8* [[PTR1]], i32 1
13; CHECK-NEXT:    store i8 10, i8* [[PTR1]]
14; CHECK-NEXT:    store i8 20, i8* [[PTR2]]
15; CHECK-NEXT:    [[LV:%.*]] = load i64, i64* [[A]]
16; CHECK-NEXT:    store i8 0, i8* [[PTR1]]
17; CHECK-NEXT:    call void @use(i64* [[A]])
18; CHECK-NEXT:    ret void
19;
20  %a = alloca i64
21  call void @use(i64* %a)
22  %ptr1 = bitcast i64* %a to i8*
23  %ptr2 = getelementptr i8, i8* %ptr1, i32 1
24
25  store i8 10, i8* %ptr1
26  store i8 20, i8* %ptr2
27  %lv = load i64, i64* %a
28  store i8 0, i8* %ptr1
29
30  call void @use(i64* %a)
31  ret void
32}
33
34define void @test2() {
35; CHECK-LABEL: @test2(
36; CHECK-NEXT:    [[A:%.*]] = alloca i64
37; CHECK-NEXT:    call void @use(i64* [[A]])
38; CHECK-NEXT:    [[PTR1:%.*]] = bitcast i64* [[A]] to i8*
39; CHECK-NEXT:    [[PTR2:%.*]] = getelementptr i8, i8* [[PTR1]], i32 1
40; CHECK-NEXT:    store i8 10, i8* [[PTR1]]
41; CHECK-NEXT:    store i8 20, i8* [[PTR2]]
42; CHECK-NEXT:    br i1 undef, label [[BB1:%.*]], label [[END:%.*]]
43; CHECK:       bb1:
44; CHECK-NEXT:    [[LV:%.*]] = load i64, i64* [[A]]
45; CHECK-NEXT:    br label [[END]]
46; CHECK:       end:
47; CHECK-NEXT:    store i8 0, i8* [[PTR1]]
48; CHECK-NEXT:    call void @use(i64* [[A]])
49; CHECK-NEXT:    ret void
50;
51  %a = alloca i64
52  call void @use(i64* %a)
53  %ptr1 = bitcast i64* %a to i8*
54  %ptr2 = getelementptr i8, i8* %ptr1, i32 1
55
56  store i8 10, i8* %ptr1
57  store i8 20, i8* %ptr2
58  br i1 undef, label %bb1, label %end
59
60bb1:
61  %lv = load i64, i64* %a
62  br label %end
63
64end:
65  store i8 0, i8* %ptr1
66  call void @use(i64* %a)
67  ret void
68}
69