brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.5 KiB · 7c31638 Raw
40 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py2; RUN: opt -passes=instcombine -S < %s | FileCheck %s3target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"4target triple = "x86_64-unknown-linux-gnu"5 6declare void @f(i32)7 8; Do not replace a 'select' with 'or' in 'select - cmp - br' sequence9define void @test(i32 %len) {10; CHECK-LABEL: @test(11; CHECK-NEXT:  entry:12; CHECK-NEXT:    [[COND:%.*]] = call i32 @llvm.umin.i32(i32 [[LEN:%.*]], i32 8)13; CHECK-NEXT:    [[CMP11_NOT:%.*]] = icmp eq i32 [[LEN]], 014; CHECK-NEXT:    br i1 [[CMP11_NOT]], label [[FOR_END:%.*]], label [[FOR_BODY:%.*]]15; CHECK:       for.body:16; CHECK-NEXT:    [[I_02:%.*]] = phi i32 [ [[INC:%.*]], [[FOR_BODY]] ], [ 0, [[ENTRY:%.*]] ]17; CHECK-NEXT:    tail call void @f(i32 [[COND]])18; CHECK-NEXT:    [[INC]] = add i32 [[I_02]], 119; CHECK-NEXT:    [[CMP1:%.*]] = icmp ult i32 [[INC]], [[COND]]20; CHECK-NEXT:    br i1 [[CMP1]], label [[FOR_BODY]], label [[FOR_END]]21; CHECK:       for.end:22; CHECK-NEXT:    ret void23;24entry:25  %cmp = icmp ult i32 %len, 826  %cond = select i1 %cmp, i32 %len, i32 827  %cmp11 = icmp ult i32 0, %cond28  br i1 %cmp11, label %for.body, label %for.end29 30for.body:                                         ; preds = %entry, %for.body31  %i.02 = phi i32 [ %inc, %for.body ], [ 0, %entry ]32  tail call void @f(i32 %cond)33  %inc = add i32 %i.02, 134  %cmp1 = icmp ult i32 %inc, %cond35  br i1 %cmp1, label %for.body, label %for.end36 37for.end:                                          ; preds = %for.body, %entry38  ret void39}40