434 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py UTC_ARGS: --version 52; RUN: opt -passes='print<access-info>' -disable-output %s 2>&1 \3; RUN: | FileCheck %s --check-prefixes=COMMON,CHECK4; RUN: opt -passes='print<access-info>' -disable-output \5; RUN: -mtriple=arm64-apple-macosx %s 2>&1 \6; RUN: | FileCheck %s --check-prefixes=COMMON,VW1287; RUN: opt -passes='print<access-info>' -disable-output \8; RUN: -mtriple=arm64-apple-macosx -mattr=+sve %s 2>&1 \9; RUN: | FileCheck %s --check-prefixes=COMMON,MAXLEN10 11; REQUIRES: aarch64-registered-target12 13target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128"14 15; If the dependence distance is not a constant, whether it gets identified as backwards or unknown depends on the minimum distance and the target's vector length.16 17define void @backward_min_distance_8(ptr %A, i64 %N) {18; COMMON-LABEL: 'backward_min_distance_8'19; COMMON-NEXT: loop:20; COMMON-NEXT: Memory dependences are safe with run-time checks21; COMMON-NEXT: Dependences:22; COMMON-NEXT: Run-time memory checks:23; COMMON-NEXT: Check 0:24; COMMON-NEXT: Comparing group GRP0:25; COMMON-NEXT: %gep.off.iv = getelementptr inbounds i8, ptr %gep.off, i64 %iv26; COMMON-NEXT: Against group GRP1:27; COMMON-NEXT: %gep = getelementptr inbounds i8, ptr %A, i64 %iv28; COMMON-NEXT: Grouped accesses:29; COMMON-NEXT: Group GRP0:30; COMMON-NEXT: (Low: {(1 + %A)<nuw>,+,1}<nuw><%outer.header> High: {(257 + %A),+,1}<nw><%outer.header>)31; COMMON-NEXT: Member: {{\{\{}}(1 + %A)<nuw>,+,1}<nuw><%outer.header>,+,1}<nuw><%loop>32; COMMON-NEXT: Group GRP1:33; COMMON-NEXT: (Low: %A High: (256 + %A))34; COMMON-NEXT: Member: {%A,+,1}<nuw><%loop>35; COMMON-EMPTY:36; COMMON-NEXT: Non vectorizable stores to invariant address were not found in loop.37; COMMON-NEXT: SCEV assumptions:38; COMMON-EMPTY:39; COMMON-NEXT: Expressions re-written:40; COMMON-NEXT: outer.header:41; COMMON-NEXT: Report: loop is not the innermost loop42; COMMON-NEXT: Dependences:43; COMMON-NEXT: Run-time memory checks:44; COMMON-NEXT: Grouped accesses:45; COMMON-EMPTY:46; COMMON-NEXT: Non vectorizable stores to invariant address were not found in loop.47; COMMON-NEXT: SCEV assumptions:48; COMMON-EMPTY:49; COMMON-NEXT: Expressions re-written:50;51entry:52 br label %outer.header53 54outer.header:55 %outer.iv = phi i64 [ 1, %entry ], [ %outer.iv.next, %outer.latch ]56 %gep.off = getelementptr inbounds i8, ptr %A, i64 %outer.iv57 br label %loop58 59loop:60 %iv = phi i64 [ 0, %outer.header ], [ %iv.next, %loop ]61 %gep = getelementptr inbounds i8, ptr %A, i64 %iv62 %l = load i8 , ptr %gep, align 463 %add = add nsw i8 %l, 564 %gep.off.iv = getelementptr inbounds i8, ptr %gep.off, i64 %iv65 store i8 %add, ptr %gep.off.iv, align 466 %iv.next = add nuw nsw i64 %iv, 167 %exitcond.not = icmp eq i64 %iv.next, 25668 br i1 %exitcond.not, label %outer.latch, label %loop69 70outer.latch:71 %outer.iv.next = add nuw nsw i64 %outer.iv, 172 %ec.2 = icmp eq i64 %outer.iv.next, %N73 br i1 %ec.2, label %exit, label %outer.header74 75exit:76 ret void77}78 79define void @backward_min_distance_120(ptr %A, i64 %N) {80; CHECK-LABEL: 'backward_min_distance_120'81; CHECK-NEXT: loop:82; CHECK-NEXT: Memory dependences are safe with a maximum safe vector width of 120 bits83; CHECK-NEXT: Dependences:84; CHECK-NEXT: BackwardVectorizable:85; CHECK-NEXT: %l = load i8, ptr %gep, align 4 ->86; CHECK-NEXT: store i8 %add, ptr %gep.off.iv, align 487; CHECK-EMPTY:88; CHECK-NEXT: Run-time memory checks:89; CHECK-NEXT: Grouped accesses:90; CHECK-EMPTY:91; CHECK-NEXT: Non vectorizable stores to invariant address were not found in loop.92; CHECK-NEXT: SCEV assumptions:93; CHECK-EMPTY:94; CHECK-NEXT: Expressions re-written:95; CHECK-NEXT: outer.header:96; CHECK-NEXT: Report: loop is not the innermost loop97; CHECK-NEXT: Dependences:98; CHECK-NEXT: Run-time memory checks:99; CHECK-NEXT: Grouped accesses:100; CHECK-EMPTY:101; CHECK-NEXT: Non vectorizable stores to invariant address were not found in loop.102; CHECK-NEXT: SCEV assumptions:103; CHECK-EMPTY:104; CHECK-NEXT: Expressions re-written:105;106; VW128-LABEL: 'backward_min_distance_120'107; VW128-NEXT: loop:108; VW128-NEXT: Memory dependences are safe with run-time checks109; VW128-NEXT: Dependences:110; VW128-NEXT: Run-time memory checks:111; VW128-NEXT: Check 0:112; VW128-NEXT: Comparing group GRP0:113; VW128-NEXT: %gep.off.iv = getelementptr inbounds i8, ptr %gep.off, i64 %iv114; VW128-NEXT: Against group GRP1:115; VW128-NEXT: %gep = getelementptr inbounds i8, ptr %A, i64 %iv116; VW128-NEXT: Grouped accesses:117; VW128-NEXT: Group GRP0:118; VW128-NEXT: (Low: {(15 + %A)<nuw>,+,1}<nuw><%outer.header> High: {(271 + %A),+,1}<nw><%outer.header>)119; VW128-NEXT: Member: {{\{\{}}(15 + %A)<nuw>,+,1}<nuw><%outer.header>,+,1}<nuw><%loop>120; VW128-NEXT: Group GRP1:121; VW128-NEXT: (Low: %A High: (256 + %A))122; VW128-NEXT: Member: {%A,+,1}<nuw><%loop>123; VW128-EMPTY:124; VW128-NEXT: Non vectorizable stores to invariant address were not found in loop.125; VW128-NEXT: SCEV assumptions:126; VW128-EMPTY:127; VW128-NEXT: Expressions re-written:128; VW128-NEXT: outer.header:129; VW128-NEXT: Report: loop is not the innermost loop130; VW128-NEXT: Dependences:131; VW128-NEXT: Run-time memory checks:132; VW128-NEXT: Grouped accesses:133; VW128-EMPTY:134; VW128-NEXT: Non vectorizable stores to invariant address were not found in loop.135; VW128-NEXT: SCEV assumptions:136; VW128-EMPTY:137; VW128-NEXT: Expressions re-written:138;139; MAXLEN-LABEL: 'backward_min_distance_120'140; MAXLEN-NEXT: loop:141; MAXLEN-NEXT: Memory dependences are safe with run-time checks142; MAXLEN-NEXT: Dependences:143; MAXLEN-NEXT: Run-time memory checks:144; MAXLEN-NEXT: Check 0:145; MAXLEN-NEXT: Comparing group GRP0:146; MAXLEN-NEXT: %gep.off.iv = getelementptr inbounds i8, ptr %gep.off, i64 %iv147; MAXLEN-NEXT: Against group GRP1:148; MAXLEN-NEXT: %gep = getelementptr inbounds i8, ptr %A, i64 %iv149; MAXLEN-NEXT: Grouped accesses:150; MAXLEN-NEXT: Group GRP0:151; MAXLEN-NEXT: (Low: {(15 + %A)<nuw>,+,1}<nuw><%outer.header> High: {(271 + %A),+,1}<nw><%outer.header>)152; MAXLEN-NEXT: Member: {{\{\{}}(15 + %A)<nuw>,+,1}<nuw><%outer.header>,+,1}<nuw><%loop>153; MAXLEN-NEXT: Group GRP1:154; MAXLEN-NEXT: (Low: %A High: (256 + %A))155; MAXLEN-NEXT: Member: {%A,+,1}<nuw><%loop>156; MAXLEN-EMPTY:157; MAXLEN-NEXT: Non vectorizable stores to invariant address were not found in loop.158; MAXLEN-NEXT: SCEV assumptions:159; MAXLEN-EMPTY:160; MAXLEN-NEXT: Expressions re-written:161; MAXLEN-NEXT: outer.header:162; MAXLEN-NEXT: Report: loop is not the innermost loop163; MAXLEN-NEXT: Dependences:164; MAXLEN-NEXT: Run-time memory checks:165; MAXLEN-NEXT: Grouped accesses:166; MAXLEN-EMPTY:167; MAXLEN-NEXT: Non vectorizable stores to invariant address were not found in loop.168; MAXLEN-NEXT: SCEV assumptions:169; MAXLEN-EMPTY:170; MAXLEN-NEXT: Expressions re-written:171;172entry:173 br label %outer.header174 175outer.header:176 %outer.iv = phi i64 [ 15, %entry ], [ %outer.iv.next, %outer.latch ]177 %gep.off = getelementptr inbounds i8, ptr %A, i64 %outer.iv178 br label %loop179 180loop:181 %iv = phi i64 [ 0, %outer.header ], [ %iv.next, %loop ]182 %gep = getelementptr inbounds i8, ptr %A, i64 %iv183 %l = load i8 , ptr %gep, align 4184 %add = add nsw i8 %l, 5185 %gep.off.iv = getelementptr inbounds i8, ptr %gep.off, i64 %iv186 store i8 %add, ptr %gep.off.iv, align 4187 %iv.next = add nuw nsw i64 %iv, 1188 %exitcond.not = icmp eq i64 %iv.next, 256189 br i1 %exitcond.not, label %outer.latch, label %loop190 191outer.latch:192 %outer.iv.next = add nuw nsw i64 %outer.iv, 1193 %ec.2 = icmp eq i64 %outer.iv.next, %N194 br i1 %ec.2, label %exit, label %outer.header195 196exit:197 ret void198}199 200define void @backward_min_distance_128(ptr %A, i64 %N) {201; CHECK-LABEL: 'backward_min_distance_128'202; CHECK-NEXT: loop:203; CHECK-NEXT: Memory dependences are safe with a maximum safe vector width of 128 bits204; CHECK-NEXT: Dependences:205; CHECK-NEXT: BackwardVectorizable:206; CHECK-NEXT: %l = load i8, ptr %gep, align 4 ->207; CHECK-NEXT: store i8 %add, ptr %gep.off.iv, align 4208; CHECK-EMPTY:209; CHECK-NEXT: Run-time memory checks:210; CHECK-NEXT: Grouped accesses:211; CHECK-EMPTY:212; CHECK-NEXT: Non vectorizable stores to invariant address were not found in loop.213; CHECK-NEXT: SCEV assumptions:214; CHECK-EMPTY:215; CHECK-NEXT: Expressions re-written:216; CHECK-NEXT: outer.header:217; CHECK-NEXT: Report: loop is not the innermost loop218; CHECK-NEXT: Dependences:219; CHECK-NEXT: Run-time memory checks:220; CHECK-NEXT: Grouped accesses:221; CHECK-EMPTY:222; CHECK-NEXT: Non vectorizable stores to invariant address were not found in loop.223; CHECK-NEXT: SCEV assumptions:224; CHECK-EMPTY:225; CHECK-NEXT: Expressions re-written:226;227; VW128-LABEL: 'backward_min_distance_128'228; VW128-NEXT: loop:229; VW128-NEXT: Memory dependences are safe with run-time checks230; VW128-NEXT: Dependences:231; VW128-NEXT: Run-time memory checks:232; VW128-NEXT: Check 0:233; VW128-NEXT: Comparing group GRP0:234; VW128-NEXT: %gep.off.iv = getelementptr inbounds i8, ptr %gep.off, i64 %iv235; VW128-NEXT: Against group GRP1:236; VW128-NEXT: %gep = getelementptr inbounds i8, ptr %A, i64 %iv237; VW128-NEXT: Grouped accesses:238; VW128-NEXT: Group GRP0:239; VW128-NEXT: (Low: {(16 + %A)<nuw>,+,1}<nuw><%outer.header> High: {(272 + %A),+,1}<nw><%outer.header>)240; VW128-NEXT: Member: {{\{\{}}(16 + %A)<nuw>,+,1}<nuw><%outer.header>,+,1}<nuw><%loop>241; VW128-NEXT: Group GRP1:242; VW128-NEXT: (Low: %A High: (256 + %A))243; VW128-NEXT: Member: {%A,+,1}<nuw><%loop>244; VW128-EMPTY:245; VW128-NEXT: Non vectorizable stores to invariant address were not found in loop.246; VW128-NEXT: SCEV assumptions:247; VW128-EMPTY:248; VW128-NEXT: Expressions re-written:249; VW128-NEXT: outer.header:250; VW128-NEXT: Report: loop is not the innermost loop251; VW128-NEXT: Dependences:252; VW128-NEXT: Run-time memory checks:253; VW128-NEXT: Grouped accesses:254; VW128-EMPTY:255; VW128-NEXT: Non vectorizable stores to invariant address were not found in loop.256; VW128-NEXT: SCEV assumptions:257; VW128-EMPTY:258; VW128-NEXT: Expressions re-written:259;260; MAXLEN-LABEL: 'backward_min_distance_128'261; MAXLEN-NEXT: loop:262; MAXLEN-NEXT: Memory dependences are safe with run-time checks263; MAXLEN-NEXT: Dependences:264; MAXLEN-NEXT: Run-time memory checks:265; MAXLEN-NEXT: Check 0:266; MAXLEN-NEXT: Comparing group GRP0:267; MAXLEN-NEXT: %gep.off.iv = getelementptr inbounds i8, ptr %gep.off, i64 %iv268; MAXLEN-NEXT: Against group GRP1:269; MAXLEN-NEXT: %gep = getelementptr inbounds i8, ptr %A, i64 %iv270; MAXLEN-NEXT: Grouped accesses:271; MAXLEN-NEXT: Group GRP0:272; MAXLEN-NEXT: (Low: {(16 + %A)<nuw>,+,1}<nuw><%outer.header> High: {(272 + %A),+,1}<nw><%outer.header>)273; MAXLEN-NEXT: Member: {{\{\{}}(16 + %A)<nuw>,+,1}<nuw><%outer.header>,+,1}<nuw><%loop>274; MAXLEN-NEXT: Group GRP1:275; MAXLEN-NEXT: (Low: %A High: (256 + %A))276; MAXLEN-NEXT: Member: {%A,+,1}<nuw><%loop>277; MAXLEN-EMPTY:278; MAXLEN-NEXT: Non vectorizable stores to invariant address were not found in loop.279; MAXLEN-NEXT: SCEV assumptions:280; MAXLEN-EMPTY:281; MAXLEN-NEXT: Expressions re-written:282; MAXLEN-NEXT: outer.header:283; MAXLEN-NEXT: Report: loop is not the innermost loop284; MAXLEN-NEXT: Dependences:285; MAXLEN-NEXT: Run-time memory checks:286; MAXLEN-NEXT: Grouped accesses:287; MAXLEN-EMPTY:288; MAXLEN-NEXT: Non vectorizable stores to invariant address were not found in loop.289; MAXLEN-NEXT: SCEV assumptions:290; MAXLEN-EMPTY:291; MAXLEN-NEXT: Expressions re-written:292;293entry:294 br label %outer.header295 296outer.header:297 %outer.iv = phi i64 [ 16, %entry ], [ %outer.iv.next, %outer.latch ]298 %gep.off = getelementptr inbounds i8, ptr %A, i64 %outer.iv299 br label %loop300 301loop:302 %iv = phi i64 [ 0, %outer.header ], [ %iv.next, %loop ]303 %gep = getelementptr inbounds i8, ptr %A, i64 %iv304 %l = load i8 , ptr %gep, align 4305 %add = add nsw i8 %l, 5306 %gep.off.iv = getelementptr inbounds i8, ptr %gep.off, i64 %iv307 store i8 %add, ptr %gep.off.iv, align 4308 %iv.next = add nuw nsw i64 %iv, 1309 %exitcond.not = icmp eq i64 %iv.next, 256310 br i1 %exitcond.not, label %outer.latch, label %loop311 312outer.latch:313 %outer.iv.next = add nuw nsw i64 %outer.iv, 1314 %ec.2 = icmp eq i64 %outer.iv.next, %N315 br i1 %ec.2, label %exit, label %outer.header316 317exit:318 ret void319}320 321define void @backward_min_distance_256(ptr %A, i64 %N) {322; CHECK-LABEL: 'backward_min_distance_256'323; CHECK-NEXT: loop:324; CHECK-NEXT: Memory dependences are safe with a maximum safe vector width of 256 bits325; CHECK-NEXT: Dependences:326; CHECK-NEXT: BackwardVectorizable:327; CHECK-NEXT: %l = load i8, ptr %gep, align 4 ->328; CHECK-NEXT: store i8 %add, ptr %gep.off.iv, align 4329; CHECK-EMPTY:330; CHECK-NEXT: Run-time memory checks:331; CHECK-NEXT: Grouped accesses:332; CHECK-EMPTY:333; CHECK-NEXT: Non vectorizable stores to invariant address were not found in loop.334; CHECK-NEXT: SCEV assumptions:335; CHECK-EMPTY:336; CHECK-NEXT: Expressions re-written:337; CHECK-NEXT: outer.header:338; CHECK-NEXT: Report: loop is not the innermost loop339; CHECK-NEXT: Dependences:340; CHECK-NEXT: Run-time memory checks:341; CHECK-NEXT: Grouped accesses:342; CHECK-EMPTY:343; CHECK-NEXT: Non vectorizable stores to invariant address were not found in loop.344; CHECK-NEXT: SCEV assumptions:345; CHECK-EMPTY:346; CHECK-NEXT: Expressions re-written:347;348; VW128-LABEL: 'backward_min_distance_256'349; VW128-NEXT: loop:350; VW128-NEXT: Memory dependences are safe with a maximum safe vector width of 256 bits351; VW128-NEXT: Dependences:352; VW128-NEXT: BackwardVectorizable:353; VW128-NEXT: %l = load i8, ptr %gep, align 4 ->354; VW128-NEXT: store i8 %add, ptr %gep.off.iv, align 4355; VW128-EMPTY:356; VW128-NEXT: Run-time memory checks:357; VW128-NEXT: Grouped accesses:358; VW128-EMPTY:359; VW128-NEXT: Non vectorizable stores to invariant address were not found in loop.360; VW128-NEXT: SCEV assumptions:361; VW128-EMPTY:362; VW128-NEXT: Expressions re-written:363; VW128-NEXT: outer.header:364; VW128-NEXT: Report: loop is not the innermost loop365; VW128-NEXT: Dependences:366; VW128-NEXT: Run-time memory checks:367; VW128-NEXT: Grouped accesses:368; VW128-EMPTY:369; VW128-NEXT: Non vectorizable stores to invariant address were not found in loop.370; VW128-NEXT: SCEV assumptions:371; VW128-EMPTY:372; VW128-NEXT: Expressions re-written:373;374; MAXLEN-LABEL: 'backward_min_distance_256'375; MAXLEN-NEXT: loop:376; MAXLEN-NEXT: Memory dependences are safe with run-time checks377; MAXLEN-NEXT: Dependences:378; MAXLEN-NEXT: Run-time memory checks:379; MAXLEN-NEXT: Check 0:380; MAXLEN-NEXT: Comparing group GRP0:381; MAXLEN-NEXT: %gep.off.iv = getelementptr inbounds i8, ptr %gep.off, i64 %iv382; MAXLEN-NEXT: Against group GRP1:383; MAXLEN-NEXT: %gep = getelementptr inbounds i8, ptr %A, i64 %iv384; MAXLEN-NEXT: Grouped accesses:385; MAXLEN-NEXT: Group GRP0:386; MAXLEN-NEXT: (Low: {(32 + %A)<nuw>,+,1}<nuw><%outer.header> High: {(288 + %A),+,1}<nw><%outer.header>)387; MAXLEN-NEXT: Member: {{\{\{}}(32 + %A)<nuw>,+,1}<nuw><%outer.header>,+,1}<nuw><%loop>388; MAXLEN-NEXT: Group GRP1:389; MAXLEN-NEXT: (Low: %A High: (256 + %A))390; MAXLEN-NEXT: Member: {%A,+,1}<nuw><%loop>391; MAXLEN-EMPTY:392; MAXLEN-NEXT: Non vectorizable stores to invariant address were not found in loop.393; MAXLEN-NEXT: SCEV assumptions:394; MAXLEN-EMPTY:395; MAXLEN-NEXT: Expressions re-written:396; MAXLEN-NEXT: outer.header:397; MAXLEN-NEXT: Report: loop is not the innermost loop398; MAXLEN-NEXT: Dependences:399; MAXLEN-NEXT: Run-time memory checks:400; MAXLEN-NEXT: Grouped accesses:401; MAXLEN-EMPTY:402; MAXLEN-NEXT: Non vectorizable stores to invariant address were not found in loop.403; MAXLEN-NEXT: SCEV assumptions:404; MAXLEN-EMPTY:405; MAXLEN-NEXT: Expressions re-written:406;407entry:408 br label %outer.header409 410outer.header:411 %outer.iv = phi i64 [ 32, %entry ], [ %outer.iv.next, %outer.latch ]412 %gep.off = getelementptr inbounds i8, ptr %A, i64 %outer.iv413 br label %loop414 415loop:416 %iv = phi i64 [ 0, %outer.header ], [ %iv.next, %loop ]417 %gep = getelementptr inbounds i8, ptr %A, i64 %iv418 %l = load i8 , ptr %gep, align 4419 %add = add nsw i8 %l, 5420 %gep.off.iv = getelementptr inbounds i8, ptr %gep.off, i64 %iv421 store i8 %add, ptr %gep.off.iv, align 4422 %iv.next = add nuw nsw i64 %iv, 1423 %exitcond.not = icmp eq i64 %iv.next, 256424 br i1 %exitcond.not, label %outer.latch, label %loop425 426outer.latch:427 %outer.iv.next = add nuw nsw i64 %outer.iv, 1428 %ec.2 = icmp eq i64 %outer.iv.next, %N429 br i1 %ec.2, label %exit, label %outer.header430 431exit:432 ret void433}434