1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py 2; RUN: opt %s -S -mtriple=riscv64 -passes=loop-unroll | FileCheck %s 3 4; Demonstrate handling of invalid costs in LoopUnroll. This test uses 5; scalable vectors on RISCV w/o +V to create a situation where a construct 6; can not be lowered, and is thus invalid regardless of what the target 7; does or does not implement in terms of a cost model. 8 9target datalayout = "e-m:e-p:64:64-i64:64-i128:128-n64-S128" 10target triple = "riscv64-unknown-unknown" 11 12define void @invalid(ptr %p) nounwind ssp { 13; CHECK-LABEL: @invalid( 14; CHECK-NEXT: entry: 15; CHECK-NEXT: br label [[FOR_BODY:%.*]] 16; CHECK: for.body: 17; CHECK-NEXT: [[I_0:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[INC:%.*]], [[FOR_BODY]] ] 18; CHECK-NEXT: [[A:%.*]] = load <vscale x 1 x i8>, ptr [[P:%.*]], align 1 19; CHECK-NEXT: [[B:%.*]] = add <vscale x 1 x i8> [[A]], [[A]] 20; CHECK-NEXT: store <vscale x 1 x i8> [[B]], ptr [[P]], align 1 21; CHECK-NEXT: [[INC]] = add nsw i32 [[I_0]], 1 22; CHECK-NEXT: [[CMP:%.*]] = icmp slt i32 [[I_0]], 10 23; CHECK-NEXT: br i1 [[CMP]], label [[FOR_BODY]], label [[FOR_END:%.*]] 24; CHECK: for.end: 25; CHECK-NEXT: ret void 26; 27entry: 28 br label %for.body 29 30for.body: ; preds = %for.body, %entry 31 %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.body ] 32 %a = load <vscale x 1 x i8>, ptr %p 33 %b = add <vscale x 1 x i8> %a, %a 34 store <vscale x 1 x i8> %b, ptr %p 35 %inc = add nsw i32 %i.0, 1 36 %cmp = icmp slt i32 %i.0, 10 37 br i1 %cmp, label %for.body, label %for.end 38 39for.end: ; preds = %for.body 40 ret void 41} 42 43 44declare void @f() 45