424 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py UTC_ARGS: --version 42; RUN: opt -passes='print<access-info><allow-partial>' -disable-output %s 2>&1 | FileCheck %s3 4target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128"5 6declare void @llvm.assume(i1)7 8define void @different_non_constant_strides_known_forward(ptr %A) {9; CHECK-LABEL: 'different_non_constant_strides_known_forward'10; CHECK-NEXT: loop:11; CHECK-NEXT: Memory dependences are safe12; CHECK-NEXT: Dependences:13; CHECK-NEXT: Forward:14; CHECK-NEXT: %l = load i32, ptr %gep.mul.2, align 4 ->15; CHECK-NEXT: store i32 %add, ptr %gep, align 416; CHECK-EMPTY:17; CHECK-NEXT: Run-time memory checks:18; CHECK-NEXT: Grouped accesses:19; CHECK-EMPTY:20; CHECK-NEXT: Non vectorizable stores to invariant address were not found in loop.21; CHECK-NEXT: SCEV assumptions:22; CHECK-EMPTY:23; CHECK-NEXT: Expressions re-written:24;25entry:26 br label %loop27 28loop:29 %iv = phi i64 [ 0, %entry ], [ %iv.next, %loop ]30 %iv.mul.2 = shl nuw nsw i64 %iv, 131 %gep.mul.2 = getelementptr inbounds i32, ptr %A, i64 %iv.mul.232 %l = load i32, ptr %gep.mul.2, align 433 %add = add nsw i32 %l, 534 %gep = getelementptr inbounds i32, ptr %A, i64 %iv35 store i32 %add, ptr %gep, align 436 %iv.next = add nuw nsw i64 %iv, 137 %exitcond.not = icmp eq i64 %iv.next, 25638 br i1 %exitcond.not, label %exit, label %loop39 40exit:41 ret void42}43 44define void @different_non_constant_strides_known_forward_min_distance_3(ptr %A) {45; CHECK-LABEL: 'different_non_constant_strides_known_forward_min_distance_3'46; CHECK-NEXT: loop:47; CHECK-NEXT: Memory dependences are safe48; CHECK-NEXT: Dependences:49; CHECK-NEXT: Forward:50; CHECK-NEXT: %l = load i32, ptr %gep.mul.2, align 4 ->51; CHECK-NEXT: store i32 %add, ptr %gep, align 452; CHECK-EMPTY:53; CHECK-NEXT: Run-time memory checks:54; CHECK-NEXT: Grouped accesses:55; CHECK-EMPTY:56; CHECK-NEXT: Non vectorizable stores to invariant address were not found in loop.57; CHECK-NEXT: SCEV assumptions:58; CHECK-EMPTY:59; CHECK-NEXT: Expressions re-written:60;61entry:62 %A.3 = getelementptr inbounds i8, ptr %A, i64 363 br label %loop64 65loop:66 %iv = phi i64 [ 0, %entry ], [ %iv.next, %loop ]67 %iv.mul.2 = shl nuw nsw i64 %iv, 168 %gep.mul.2 = getelementptr inbounds i32, ptr %A.3, i64 %iv.mul.269 %l = load i32, ptr %gep.mul.2, align 470 %add = add nsw i32 %l, 571 %gep = getelementptr inbounds i32, ptr %A, i64 %iv72 store i32 %add, ptr %gep, align 473 %iv.next = add nuw nsw i64 %iv, 174 %exitcond.not = icmp eq i64 %iv.next, 25675 br i1 %exitcond.not, label %exit, label %loop76 77exit:78 ret void79}80 81define void @different_non_constant_strides_known_forward_via_assume(ptr %A, i64 %scale) {82; CHECK-LABEL: 'different_non_constant_strides_known_forward_via_assume'83; CHECK-NEXT: loop:84; CHECK-NEXT: Report: cannot identify array bounds85; CHECK-NEXT: Dependences:86; CHECK-NEXT: Run-time memory checks:87; CHECK-NEXT: Grouped accesses:88; CHECK-NEXT: Group GRP0:89; CHECK-NEXT: (Low: %A High: (1024 + %A))90; CHECK-NEXT: Member: {%A,+,4}<nuw><%loop>91; CHECK-NEXT: Generated run-time checks are incomplete92; CHECK-EMPTY:93; CHECK-NEXT: Non vectorizable stores to invariant address were not found in loop.94; CHECK-NEXT: SCEV assumptions:95; CHECK-EMPTY:96; CHECK-NEXT: Expressions re-written:97;98entry:99 %c = icmp sgt i64 %scale, 0100 call void @llvm.assume(i1 %c)101 br label %loop102 103loop:104 %iv = phi i64 [ 0, %entry ], [ %iv.next, %loop ]105 %iv.mul.2 = shl nuw nsw i64 %iv, %scale106 %gep.mul.2 = getelementptr inbounds i32, ptr %A, i64 %iv.mul.2107 %l = load i32, ptr %gep.mul.2, align 4108 %add = add nsw i32 %l, 5109 %gep = getelementptr inbounds i32, ptr %A, i64 %iv110 store i32 %add, ptr %gep, align 4111 %iv.next = add nuw nsw i64 %iv, 1112 %exitcond.not = icmp eq i64 %iv.next, 256113 br i1 %exitcond.not, label %exit, label %loop114 115exit:116 ret void117}118 119define void @different_non_constant_strides_known_forward_via_assume_min_distance_3(ptr %A, i64 %scale) {120; CHECK-LABEL: 'different_non_constant_strides_known_forward_via_assume_min_distance_3'121; CHECK-NEXT: loop:122; CHECK-NEXT: Report: cannot identify array bounds123; CHECK-NEXT: Dependences:124; CHECK-NEXT: Run-time memory checks:125; CHECK-NEXT: Grouped accesses:126; CHECK-NEXT: Group GRP0:127; CHECK-NEXT: (Low: %A High: (1024 + %A))128; CHECK-NEXT: Member: {%A,+,4}<nuw><%loop>129; CHECK-NEXT: Generated run-time checks are incomplete130; CHECK-EMPTY:131; CHECK-NEXT: Non vectorizable stores to invariant address were not found in loop.132; CHECK-NEXT: SCEV assumptions:133; CHECK-EMPTY:134; CHECK-NEXT: Expressions re-written:135;136entry:137 %A.3 = getelementptr inbounds i8, ptr %A, i64 3138 %c = icmp sgt i64 %scale, 0139 call void @llvm.assume(i1 %c)140 br label %loop141 142loop:143 %iv = phi i64 [ 0, %entry ], [ %iv.next, %loop ]144 %iv.mul.2 = shl nuw nsw i64 %iv, %scale145 %gep.mul.2 = getelementptr inbounds i32, ptr %A.3, i64 %iv.mul.2146 %l = load i32, ptr %gep.mul.2, align 4147 %add = add nsw i32 %l, 5148 %gep = getelementptr inbounds i32, ptr %A, i64 %iv149 store i32 %add, ptr %gep, align 4150 %iv.next = add nuw nsw i64 %iv, 1151 %exitcond.not = icmp eq i64 %iv.next, 256152 br i1 %exitcond.not, label %exit, label %loop153 154exit:155 ret void156}157 158define void @different_non_constant_strides_not_known_forward(ptr %A, i64 %scale) {159; CHECK-LABEL: 'different_non_constant_strides_not_known_forward'160; CHECK-NEXT: loop:161; CHECK-NEXT: Report: cannot identify array bounds162; CHECK-NEXT: Dependences:163; CHECK-NEXT: Run-time memory checks:164; CHECK-NEXT: Grouped accesses:165; CHECK-NEXT: Group GRP0:166; CHECK-NEXT: (Low: %A High: (1024 + %A))167; CHECK-NEXT: Member: {%A,+,4}<nuw><%loop>168; CHECK-NEXT: Generated run-time checks are incomplete169; CHECK-EMPTY:170; CHECK-NEXT: Non vectorizable stores to invariant address were not found in loop.171; CHECK-NEXT: SCEV assumptions:172; CHECK-EMPTY:173; CHECK-NEXT: Expressions re-written:174;175entry:176 br label %loop177 178loop:179 %iv = phi i64 [ 0, %entry ], [ %iv.next, %loop ]180 %iv.mul.2 = shl nuw nsw i64 %iv, %scale181 %gep.mul.2 = getelementptr inbounds i32, ptr %A, i64 %iv.mul.2182 %l = load i32, ptr %gep.mul.2, align 4183 %add = add nsw i32 %l, 5184 %gep = getelementptr inbounds i32, ptr %A, i64 %iv185 store i32 %add, ptr %gep, align 4186 %iv.next = add nuw nsw i64 %iv, 1187 %exitcond.not = icmp eq i64 %iv.next, 256188 br i1 %exitcond.not, label %exit, label %loop189 190exit:191 ret void192}193 194; Tests with accesses with strides with different signs.195define void @strides_with_different_directions_1(ptr %A) {196; CHECK-LABEL: 'strides_with_different_directions_1'197; CHECK-NEXT: loop:198; CHECK-NEXT: Report: unsafe dependent memory operations in loop. Use #pragma clang loop distribute(enable) to allow loop distribution to attempt to isolate the offending operations into a separate loop199; CHECK-NEXT: Unknown data dependence.200; CHECK-NEXT: Dependences:201; CHECK-NEXT: Unknown:202; CHECK-NEXT: %l = load i32, ptr %gep.mul.2, align 4 ->203; CHECK-NEXT: store i32 %add, ptr %gep, align 4204; CHECK-EMPTY:205; CHECK-NEXT: Run-time memory checks:206; CHECK-NEXT: Grouped accesses:207; CHECK-EMPTY:208; CHECK-NEXT: Non vectorizable stores to invariant address were not found in loop.209; CHECK-NEXT: SCEV assumptions:210; CHECK-EMPTY:211; CHECK-NEXT: Expressions re-written:212;213entry:214 br label %loop215 216loop:217 %iv.1 = phi i64 [ 0, %entry ], [ %iv.1.next, %loop ]218 %iv.2 = phi i64 [ 300, %entry ], [ %iv.2.next, %loop ]219 %gep.mul.2 = getelementptr inbounds i32, ptr %A, i64 %iv.1220 %l = load i32, ptr %gep.mul.2, align 4221 %add = add nsw i32 %l, 5222 %gep = getelementptr inbounds i32, ptr %A, i64 %iv.2223 store i32 %add, ptr %gep, align 4224 %iv.1.next = add nuw nsw i64 %iv.1, 1225 %iv.2.next = add nsw i64 %iv.2, -1226 %exitcond.not = icmp eq i64 %iv.1.next, 256227 br i1 %exitcond.not, label %exit, label %loop228 229exit:230 ret void231}232 233define void @strides_with_different_directions_2(ptr %A) {234; CHECK-LABEL: 'strides_with_different_directions_2'235; CHECK-NEXT: loop:236; CHECK-NEXT: Report: unsafe dependent memory operations in loop. Use #pragma clang loop distribute(enable) to allow loop distribution to attempt to isolate the offending operations into a separate loop237; CHECK-NEXT: Unknown data dependence.238; CHECK-NEXT: Dependences:239; CHECK-NEXT: Unknown:240; CHECK-NEXT: %l = load i32, ptr %gep.mul.2, align 4 ->241; CHECK-NEXT: store i32 %add, ptr %gep, align 4242; CHECK-EMPTY:243; CHECK-NEXT: Run-time memory checks:244; CHECK-NEXT: Grouped accesses:245; CHECK-EMPTY:246; CHECK-NEXT: Non vectorizable stores to invariant address were not found in loop.247; CHECK-NEXT: SCEV assumptions:248; CHECK-EMPTY:249; CHECK-NEXT: Expressions re-written:250;251entry:252 br label %loop253 254loop:255 %iv.1 = phi i64 [ 0, %entry ], [ %iv.1.next, %loop ]256 %iv.2 = phi i64 [ 300, %entry ], [ %iv.2.next, %loop ]257 %gep.mul.2 = getelementptr inbounds i32, ptr %A, i64 %iv.2258 %l = load i32, ptr %gep.mul.2, align 4259 %add = add nsw i32 %l, 5260 %gep = getelementptr inbounds i32, ptr %A, i64 %iv.1261 store i32 %add, ptr %gep, align 4262 %iv.1.next = add nuw nsw i64 %iv.1, 1263 %iv.2.next = add nsw i64 %iv.2, -1264 %exitcond.not = icmp eq i64 %iv.1.next, 256265 br i1 %exitcond.not, label %exit, label %loop266 267exit:268 ret void269}270 271define void @strides_with_different_directions_3(ptr %A) {272; CHECK-LABEL: 'strides_with_different_directions_3'273; CHECK-NEXT: loop:274; CHECK-NEXT: Report: unsafe dependent memory operations in loop. Use #pragma clang loop distribute(enable) to allow loop distribution to attempt to isolate the offending operations into a separate loop275; CHECK-NEXT: Unknown data dependence.276; CHECK-NEXT: Dependences:277; CHECK-NEXT: Unknown:278; CHECK-NEXT: %l = load i32, ptr %gep.mul.2, align 4 ->279; CHECK-NEXT: store i32 %add, ptr %gep, align 4280; CHECK-EMPTY:281; CHECK-NEXT: Run-time memory checks:282; CHECK-NEXT: Grouped accesses:283; CHECK-EMPTY:284; CHECK-NEXT: Non vectorizable stores to invariant address were not found in loop.285; CHECK-NEXT: SCEV assumptions:286; CHECK-EMPTY:287; CHECK-NEXT: Expressions re-written:288;289entry:290 br label %loop291 292loop:293 %iv.1 = phi i64 [ 0, %entry ], [ %iv.1.next, %loop ]294 %iv.2 = phi i64 [ 600, %entry ], [ %iv.2.next, %loop ]295 %gep.mul.2 = getelementptr inbounds i32, ptr %A, i64 %iv.1296 %l = load i32, ptr %gep.mul.2, align 4297 %add = add nsw i32 %l, 5298 %gep = getelementptr inbounds i32, ptr %A, i64 %iv.2299 store i32 %add, ptr %gep, align 4300 %iv.1.next = add nuw nsw i64 %iv.1, 1301 %iv.2.next = add nsw i64 %iv.2, -2302 %exitcond.not = icmp eq i64 %iv.1.next, 256303 br i1 %exitcond.not, label %exit, label %loop304 305exit:306 ret void307}308 309define void @strides_with_different_directions_4(ptr %A) {310; CHECK-LABEL: 'strides_with_different_directions_4'311; CHECK-NEXT: loop:312; CHECK-NEXT: Report: unsafe dependent memory operations in loop. Use #pragma clang loop distribute(enable) to allow loop distribution to attempt to isolate the offending operations into a separate loop313; CHECK-NEXT: Unknown data dependence.314; CHECK-NEXT: Dependences:315; CHECK-NEXT: Unknown:316; CHECK-NEXT: %l = load i32, ptr %gep.mul.2, align 4 ->317; CHECK-NEXT: store i32 %add, ptr %gep, align 4318; CHECK-EMPTY:319; CHECK-NEXT: Run-time memory checks:320; CHECK-NEXT: Grouped accesses:321; CHECK-EMPTY:322; CHECK-NEXT: Non vectorizable stores to invariant address were not found in loop.323; CHECK-NEXT: SCEV assumptions:324; CHECK-EMPTY:325; CHECK-NEXT: Expressions re-written:326;327entry:328 br label %loop329 330loop:331 %iv.1 = phi i64 [ 0, %entry ], [ %iv.1.next, %loop ]332 %iv.2 = phi i64 [ 600, %entry ], [ %iv.2.next, %loop ]333 %gep.mul.2 = getelementptr inbounds i32, ptr %A, i64 %iv.2334 %l = load i32, ptr %gep.mul.2, align 4335 %add = add nsw i32 %l, 5336 %gep = getelementptr inbounds i32, ptr %A, i64 %iv.1337 store i32 %add, ptr %gep, align 4338 %iv.1.next = add nuw nsw i64 %iv.1, 1339 %iv.2.next = add nsw i64 %iv.2, -2340 %exitcond.not = icmp eq i64 %iv.1.next, 256341 br i1 %exitcond.not, label %exit, label %loop342 343exit:344 ret void345}346 347define void @non_constant_strides_with_different_directions_1(ptr %A) {348; CHECK-LABEL: 'non_constant_strides_with_different_directions_1'349; CHECK-NEXT: loop:350; CHECK-NEXT: Report: unsafe dependent memory operations in loop. Use #pragma clang loop distribute(enable) to allow loop distribution to attempt to isolate the offending operations into a separate loop351; CHECK-NEXT: Unknown data dependence.352; CHECK-NEXT: Dependences:353; CHECK-NEXT: Unknown:354; CHECK-NEXT: %l = load i32, ptr %gep.mul.2, align 4 ->355; CHECK-NEXT: store i32 %add, ptr %gep, align 4356; CHECK-EMPTY:357; CHECK-NEXT: Run-time memory checks:358; CHECK-NEXT: Grouped accesses:359; CHECK-EMPTY:360; CHECK-NEXT: Non vectorizable stores to invariant address were not found in loop.361; CHECK-NEXT: SCEV assumptions:362; CHECK-EMPTY:363; CHECK-NEXT: Expressions re-written:364;365entry:366 br label %loop367 368loop:369 %iv.1 = phi i64 [ 0, %entry ], [ %iv.1.next, %loop ]370 %iv.2 = phi i64 [ 300, %entry ], [ %iv.2.next, %loop ]371 %iv.mul.2 = shl nuw nsw i64 %iv.1, 1372 %gep.mul.2 = getelementptr inbounds i32, ptr %A, i64 %iv.mul.2373 %l = load i32, ptr %gep.mul.2, align 4374 %add = add nsw i32 %l, 5375 %gep = getelementptr inbounds i32, ptr %A, i64 %iv.2376 store i32 %add, ptr %gep, align 4377 %iv.1.next = add nuw nsw i64 %iv.1, 1378 %iv.2.next = add nsw i64 %iv.2, -1379 %exitcond.not = icmp eq i64 %iv.1.next, 256380 br i1 %exitcond.not, label %exit, label %loop381 382exit:383 ret void384}385 386define void @non_constant_strides_with_different_directions_2(ptr %A) {387; CHECK-LABEL: 'non_constant_strides_with_different_directions_2'388; CHECK-NEXT: loop:389; CHECK-NEXT: Report: unsafe dependent memory operations in loop. Use #pragma clang loop distribute(enable) to allow loop distribution to attempt to isolate the offending operations into a separate loop390; CHECK-NEXT: Unknown data dependence.391; CHECK-NEXT: Dependences:392; CHECK-NEXT: Unknown:393; CHECK-NEXT: %l = load i32, ptr %gep.mul.2, align 4 ->394; CHECK-NEXT: store i32 %add, ptr %gep, align 4395; CHECK-EMPTY:396; CHECK-NEXT: Run-time memory checks:397; CHECK-NEXT: Grouped accesses:398; CHECK-EMPTY:399; CHECK-NEXT: Non vectorizable stores to invariant address were not found in loop.400; CHECK-NEXT: SCEV assumptions:401; CHECK-EMPTY:402; CHECK-NEXT: Expressions re-written:403;404entry:405 br label %loop406 407loop:408 %iv.1 = phi i64 [ 0, %entry ], [ %iv.1.next, %loop ]409 %iv.2 = phi i64 [ 300, %entry ], [ %iv.2.next, %loop ]410 %iv.mul.2 = shl nuw nsw i64 %iv.2, 1411 %gep.mul.2 = getelementptr inbounds i32, ptr %A, i64 %iv.mul.2412 %l = load i32, ptr %gep.mul.2, align 4413 %add = add nsw i32 %l, 5414 %gep = getelementptr inbounds i32, ptr %A, i64 %iv.1415 store i32 %add, ptr %gep, align 4416 %iv.1.next = add nuw nsw i64 %iv.1, 1417 %iv.2.next = add nsw i64 %iv.2, -1418 %exitcond.not = icmp eq i64 %iv.1.next, 256419 br i1 %exitcond.not, label %exit, label %loop420 421exit:422 ret void423}424