brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.8 KiB · 5bdfd19 Raw
45 lines · plain
1; RUN: opt < %s -passes=loop-vectorize -force-vector-interleave=1 -force-vector-width=4 -S |FileCheck %s2; SCEV expansion uses existing value or value + offset to reduce duplicate code expansion so foo should only generate one select inst after loop vectorization.3; CHECK-LABEL: @foo(4; CHECK: select5; CHECK-NOT: select6 7@ySrcL = common global ptr null, align 88@smL = common global i32 0, align 49 10define void @foo(i32 %rwL, i32 %kL, i32 %xfL) {11entry:12  %sub = add nsw i32 %rwL, -113  %shr = ashr i32 %xfL, 614  %cmp.i = icmp slt i32 %sub, %shr15  %cond.i = select i1 %cmp.i, i32 %sub, i32 %shr16  %cmp6 = icmp sgt i32 %cond.i, %kL17  br i1 %cmp6, label %for.body.lr.ph, label %for.end18 19for.body.lr.ph:                                   ; preds = %entry20  %tmp = load ptr, ptr @ySrcL, align 821  %tmp1 = sext i32 %kL to i6422  %tmp2 = sext i32 %cond.i to i6423  br label %for.body24 25for.body:                                         ; preds = %for.body, %for.body.lr.ph26  %indvars.iv = phi i64 [ %tmp1, %for.body.lr.ph ], [ %indvars.iv.next, %for.body ]27  %reduct.07 = phi i32 [ 0, %for.body.lr.ph ], [ %add, %for.body ]28  %arrayidx = getelementptr inbounds i8, ptr %tmp, i64 %indvars.iv29  %tmp3 = load i8, ptr %arrayidx, align 130  %conv = zext i8 %tmp3 to i3231  %add = add nsw i32 %conv, %reduct.0732  %indvars.iv.next = add nsw i64 %indvars.iv, 133  %cmp = icmp slt i64 %indvars.iv.next, %tmp234  br i1 %cmp, label %for.body, label %for.end.loopexit35 36for.end.loopexit:                                 ; preds = %for.body37  %add.lcssa = phi i32 [ %add, %for.body ]38  br label %for.end39 40for.end:                                          ; preds = %for.end.loopexit, %entry41  %reduct.0.lcssa = phi i32 [ 0, %entry ], [ %add.lcssa, %for.end.loopexit ]42  store i32 %reduct.0.lcssa, ptr @smL, align 443  ret void44}45