1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -passes=dse -S | FileCheck %s
4 target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"
6 define void @second_store_smaller_1(ptr noalias %P, i1 %c) {
7 ; CHECK-LABEL: @second_store_smaller_1(
8 ; CHECK-NEXT: store i32 0, ptr [[P:%.*]], align 4
9 ; CHECK-NEXT: br i1 [[C:%.*]], label [[BB1:%.*]], label [[BB2:%.*]]
11 ; CHECK-NEXT: br label [[BB3:%.*]]
13 ; CHECK-NEXT: br label [[BB3]]
15 ; CHECK-NEXT: ret void
18 br i1 %c, label %bb1, label %bb2
28 define void @second_store_smaller_2(ptr noalias %P, i1 %c) {
29 ; CHECK-LABEL: @second_store_smaller_2(
30 ; CHECK-NEXT: store i32 12345, ptr [[P:%.*]], align 4
31 ; CHECK-NEXT: br i1 [[C:%.*]], label [[BB1:%.*]], label [[BB2:%.*]]
33 ; CHECK-NEXT: br label [[BB3:%.*]]
35 ; CHECK-NEXT: br label [[BB3]]
37 ; CHECK-NEXT: ret void
40 br i1 %c, label %bb1, label %bb2
46 store i16 12345, ptr %P
50 declare void @use(i16) readnone
51 declare void @use.i8(i8) readnone
53 define void @second_store_smaller_3(ptr noalias %P, i1 %c) {
54 ; CHECK-LABEL: @second_store_smaller_3(
55 ; CHECK-NEXT: store i32 1, ptr [[P:%.*]], align 4
56 ; CHECK-NEXT: br i1 [[C:%.*]], label [[BB1:%.*]], label [[BB2:%.*]]
58 ; CHECK-NEXT: [[L1:%.*]] = load i16, ptr [[P]], align 2
59 ; CHECK-NEXT: call void @use(i16 [[L1]])
60 ; CHECK-NEXT: br label [[BB3:%.*]]
62 ; CHECK-NEXT: br label [[BB3]]
64 ; CHECK-NEXT: store i16 -31073, ptr [[P]], align 2
65 ; CHECK-NEXT: ret void
68 br i1 %c, label %bb1, label %bb2
71 %l1 = load i16, ptr %P
72 call void @use(i16 %l1)
77 store i16 -31073, ptr %P
81 define void @second_store_smaller_4(ptr noalias %P, i1 %c) {
82 ; CHECK-LABEL: @second_store_smaller_4(
83 ; CHECK-NEXT: store i32 1, ptr [[P:%.*]], align 4
84 ; CHECK-NEXT: br i1 [[C:%.*]], label [[BB1:%.*]], label [[BB2:%.*]]
86 ; CHECK-NEXT: [[L1:%.*]] = load i8, ptr [[P]], align 1
87 ; CHECK-NEXT: call void @use.i8(i8 [[L1]])
88 ; CHECK-NEXT: br label [[BB3:%.*]]
90 ; CHECK-NEXT: br label [[BB3]]
92 ; CHECK-NEXT: store i16 -31073, ptr [[P]], align 2
93 ; CHECK-NEXT: ret void
96 br i1 %c, label %bb1, label %bb2
100 call void @use.i8(i8 %l1)
105 store i16 -31073, ptr %P
109 define void @second_store_smaller_5(ptr noalias %P, i16 %x, i1 %c) {
110 ; CHECK-LABEL: @second_store_smaller_5(
111 ; CHECK-NEXT: store i32 1, ptr [[P:%.*]], align 4
112 ; CHECK-NEXT: br i1 [[C:%.*]], label [[BB1:%.*]], label [[BB2:%.*]]
114 ; CHECK-NEXT: br label [[BB3:%.*]]
116 ; CHECK-NEXT: br label [[BB3]]
118 ; CHECK-NEXT: store i16 [[X:%.*]], ptr [[P]], align 2
119 ; CHECK-NEXT: ret void
122 br i1 %c, label %bb1, label %bb2
132 define void @second_store_bigger(ptr noalias %P, i1 %c) {
133 ; CHECK-LABEL: @second_store_bigger(
134 ; CHECK-NEXT: br i1 [[C:%.*]], label [[BB1:%.*]], label [[BB2:%.*]]
136 ; CHECK-NEXT: br label [[BB3:%.*]]
138 ; CHECK-NEXT: br label [[BB3]]
140 ; CHECK-NEXT: store i64 0, ptr [[P:%.*]], align 8
141 ; CHECK-NEXT: ret void
144 br i1 %c, label %bb1, label %bb2