85 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py2; RUN: opt -S -passes='licm,guard-widening,licm' -verify-memoryssa -debug-pass-manager < %s 2>&1 | FileCheck %s3 4; Main point of this test is to check the scheduling -- there should be5; no analysis passes needed between LICM and LoopGuardWidening6 7; CHECK: LICMPass8; CHECK-NEXT: GuardWideningPass9; CHECK-NEXT: LICMPass10 11declare void @llvm.experimental.guard(i1,...)12 13define void @iter(i32 %a, i32 %b, ptr %c_p) {14; CHECK-LABEL: @iter(15; CHECK-NEXT: entry:16; CHECK-NEXT: [[B_GW_FR:%.*]] = freeze i32 [[B:%.*]]17; CHECK-NEXT: [[COND_0:%.*]] = icmp ult i32 [[A:%.*]], 1018; CHECK-NEXT: [[COND_1:%.*]] = icmp ult i32 [[B_GW_FR]], 1019; CHECK-NEXT: [[WIDE_CHK:%.*]] = and i1 [[COND_0]], [[COND_1]]20; CHECK-NEXT: call void (i1, ...) @llvm.experimental.guard(i1 [[WIDE_CHK]]) [ "deopt"() ]21; CHECK-NEXT: [[CND:%.*]] = load i1, ptr [[C_P:%.*]], align 122; CHECK-NEXT: br label [[LOOP:%.*]]23; CHECK: loop:24; CHECK-NEXT: br i1 [[CND]], label [[LOOP]], label [[LEAVE_LOOPEXIT:%.*]]25; CHECK: leave.loopexit:26; CHECK-NEXT: br label [[LEAVE:%.*]]27; CHECK: leave:28; CHECK-NEXT: ret void29;30 31entry:32 %cond_0 = icmp ult i32 %a, 1033 call void (i1, ...) @llvm.experimental.guard(i1 %cond_0) [ "deopt"() ]34 br label %loop35 36loop: ; preds = %loop.preheader, %loop37 %cond_1 = icmp ult i32 %b, 1038 call void (i1, ...) @llvm.experimental.guard(i1 %cond_1) [ "deopt"() ]39 %cnd = load i1, ptr %c_p40 br i1 %cnd, label %loop, label %leave.loopexit41 42leave.loopexit: ; preds = %loop43 br label %leave44 45leave: ; preds = %leave.loopexit, %entry46 ret void47}48 49define void @within_loop(i32 %a, i32 %b, ptr %c_p) {50; CHECK-LABEL: @within_loop(51; CHECK-NEXT: entry:52; CHECK-NEXT: [[B_GW_FR:%.*]] = freeze i32 [[B:%.*]]53; CHECK-NEXT: [[COND_0:%.*]] = icmp ult i32 [[A:%.*]], 1054; CHECK-NEXT: [[COND_1:%.*]] = icmp ult i32 [[B_GW_FR]], 1055; CHECK-NEXT: [[WIDE_CHK:%.*]] = and i1 [[COND_0]], [[COND_1]]56; CHECK-NEXT: call void (i1, ...) @llvm.experimental.guard(i1 [[WIDE_CHK]]) [ "deopt"() ]57; CHECK-NEXT: [[CND:%.*]] = load i1, ptr [[C_P:%.*]], align 158; CHECK-NEXT: br label [[LOOP:%.*]]59; CHECK: loop:60; CHECK-NEXT: br i1 [[CND]], label [[LOOP]], label [[LEAVE_LOOPEXIT:%.*]]61; CHECK: leave.loopexit:62; CHECK-NEXT: br label [[LEAVE:%.*]]63; CHECK: leave:64; CHECK-NEXT: ret void65;66 67entry:68 br label %loop69 70loop: ; preds = %loop.preheader, %loop71 %cond_0 = icmp ult i32 %a, 1072 call void (i1, ...) @llvm.experimental.guard(i1 %cond_0) [ "deopt"() ]73 %cond_1 = icmp ult i32 %b, 1074 call void (i1, ...) @llvm.experimental.guard(i1 %cond_1) [ "deopt"() ]75 %cnd = load i1, ptr %c_p76 br i1 %cnd, label %loop, label %leave.loopexit77 78leave.loopexit: ; preds = %loop79 br label %leave80 81leave: ; preds = %leave.loopexit, %entry82 ret void83}84 85