brintos

brintos / llvm-project-archived public Read only

0
0
Text · 5.3 KiB · 9f77bbf Raw
115 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 62; RUN: opt < %s -passes=loop-versioning -S -o - | FileCheck %s3 4; This test case used to end like this:5;6;    Instruction does not dominate all uses!7;      %t2 = load i16, i16* @b, align 1, !tbaa !2, !alias.scope !68;      %tobool = icmp eq i16 %t2, 09;    LLVM ERROR: Broken function found, compilation aborted!10;11; due to a fault where we did not replace the use of %t2 in the icmp in12; for.end, when adding a new PHI node for the versioned loops based on the13; loop-defined values used outside of the loop.14;15; Verify that the code compiles, that we get a versioned loop, and that the16; uses of %t2 in for.end and if.then are updated to use the value from the17; added phi node.18 19@a = dso_local global i16 0, align 120@b = dso_local global i16 0, align 121@c = dso_local global ptr null, align 122 23define void @f1() {24; CHECK-LABEL: define void @f1() {25; CHECK-NEXT:  [[ENTRY:.*:]]26; CHECK-NEXT:    [[T0:%.*]] = load ptr, ptr @c, align 127; CHECK-NEXT:    [[SCEVGEP:%.*]] = getelementptr i8, ptr [[T0]], i64 228; CHECK-NEXT:    br label %[[FOR_BODY_LVER_CHECK:.*]]29; CHECK:       [[FOR_BODY_LVER_CHECK]]:30; CHECK-NEXT:    [[BOUND0:%.*]] = icmp ult ptr [[T0]], getelementptr inbounds nuw (i8, ptr @b, i64 2)31; CHECK-NEXT:    [[BOUND1:%.*]] = icmp ult ptr @b, [[SCEVGEP]]32; CHECK-NEXT:    [[FOUND_CONFLICT:%.*]] = and i1 [[BOUND0]], [[BOUND1]]33; CHECK-NEXT:    br i1 [[FOUND_CONFLICT]], label %[[FOR_BODY_PH_LVER_ORIG:.*]], label %[[FOR_BODY_PH:.*]]34; CHECK:       [[FOR_BODY_PH_LVER_ORIG]]:35; CHECK-NEXT:    br label %[[FOR_BODY_LVER_ORIG:.*]]36; CHECK:       [[FOR_BODY_LVER_ORIG]]:37; CHECK-NEXT:    [[T1_LVER_ORIG:%.*]] = phi i64 [ 0, %[[FOR_BODY_PH_LVER_ORIG]] ], [ [[INC_LVER_ORIG:%.*]], %[[FOR_BODY_LVER_ORIG]] ]38; CHECK-NEXT:    [[T2_LVER_ORIG:%.*]] = load i16, ptr @b, align 1, !tbaa [[LONG_LONG_TBAA2:![0-9]+]]39; CHECK-NEXT:    store i16 [[T2_LVER_ORIG]], ptr [[T0]], align 1, !tbaa [[LONG_LONG_TBAA2]]40; CHECK-NEXT:    [[INC_LVER_ORIG]] = add nuw nsw i64 [[T1_LVER_ORIG]], 141; CHECK-NEXT:    [[CMP_LVER_ORIG:%.*]] = icmp ult i64 [[INC_LVER_ORIG]], 342; CHECK-NEXT:    br i1 [[CMP_LVER_ORIG]], label %[[FOR_BODY_LVER_ORIG]], label %[[FOR_END_LOOPEXIT:.*]]43; CHECK:       [[FOR_BODY_PH]]:44; CHECK-NEXT:    br label %[[FOR_BODY:.*]]45; CHECK:       [[FOR_BODY]]:46; CHECK-NEXT:    [[T1:%.*]] = phi i64 [ 0, %[[FOR_BODY_PH]] ], [ [[INC:%.*]], %[[FOR_BODY]] ]47; CHECK-NEXT:    [[T2:%.*]] = load i16, ptr @b, align 1, !tbaa [[LONG_LONG_TBAA2]], !alias.scope [[META6:![0-9]+]]48; CHECK-NEXT:    store i16 [[T2]], ptr [[T0]], align 1, !tbaa [[LONG_LONG_TBAA2]], !alias.scope [[META9:![0-9]+]], !noalias [[META6]]49; CHECK-NEXT:    [[INC]] = add nuw nsw i64 [[T1]], 150; CHECK-NEXT:    [[CMP:%.*]] = icmp ult i64 [[INC]], 351; CHECK-NEXT:    br i1 [[CMP]], label %[[FOR_BODY]], label %[[FOR_END_LOOPEXIT1:.*]]52; CHECK:       [[FOR_END_LOOPEXIT]]:53; CHECK-NEXT:    [[T2_LVER_PH:%.*]] = phi i16 [ [[T2_LVER_ORIG]], %[[FOR_BODY_LVER_ORIG]] ]54; CHECK-NEXT:    br label %[[FOR_END:.*]]55; CHECK:       [[FOR_END_LOOPEXIT1]]:56; CHECK-NEXT:    [[T2_LVER_PH2:%.*]] = phi i16 [ [[T2]], %[[FOR_BODY]] ]57; CHECK-NEXT:    br label %[[FOR_END]]58; CHECK:       [[FOR_END]]:59; CHECK-NEXT:    [[T2_LVER:%.*]] = phi i16 [ [[T2_LVER_PH]], %[[FOR_END_LOOPEXIT]] ], [ [[T2_LVER_PH2]], %[[FOR_END_LOOPEXIT1]] ]60; CHECK-NEXT:    [[TOBOOL:%.*]] = icmp eq i16 [[T2_LVER]], 061; CHECK-NEXT:    br i1 [[TOBOOL]], label %[[FOR_COND_BACKEDGE:.*]], label %[[IF_THEN:.*]]62; CHECK:       [[FOR_COND_BACKEDGE]]:63; CHECK-NEXT:    br label %[[FOR_BODY_LVER_CHECK]]64; CHECK:       [[IF_THEN]]:65; CHECK-NEXT:    store i16 [[T2_LVER]], ptr @a, align 1, !tbaa [[LONG_LONG_TBAA2]]66; CHECK-NEXT:    br label %[[FOR_COND_BACKEDGE]]67;68entry:69  %t0 = load ptr, ptr @c, align 170  br label %for.cond71 72for.cond:                                         ; preds = %for.cond.backedge, %entry73  br label %for.body74 75for.body:                                         ; preds = %for.cond, %for.body76  %t1 = phi i64 [ 0, %for.cond ], [ %inc, %for.body ]77  %t2 = load i16, ptr @b, align 1, !tbaa !278  store i16 %t2, ptr %t0, align 1, !tbaa !279  %inc = add nuw nsw i64 %t1, 180  %cmp = icmp ult i64 %inc, 381  br i1 %cmp, label %for.body, label %for.end82 83for.end:                                          ; preds = %for.body84  %tobool = icmp eq i16 %t2, 085  br i1 %tobool, label %for.cond.backedge, label %if.then86 87for.cond.backedge:                                ; preds = %for.end, %if.then88  br label %for.cond89 90if.then:                                          ; preds = %for.end91  store i16 %t2, ptr @a, align 1, !tbaa !292  br label %for.cond.backedge93}94 95!llvm.module.flags = !{!0}96!llvm.ident = !{!1}97 98!0 = !{i32 1, !"wchar_size", i32 1}99!1 = !{!"clang version 7.0.0"}100!2 = !{!3, !3, i64 0}101!3 = !{!"long long", !4, i64 0}102!4 = !{!"omnipotent char", !5, i64 0}103!5 = !{!"Simple C/C++ TBAA"}104;.105; CHECK: [[LONG_LONG_TBAA2]] = !{[[META3:![0-9]+]], [[META3]], i64 0}106; CHECK: [[META3]] = !{!"long long", [[META4:![0-9]+]], i64 0}107; CHECK: [[META4]] = !{!"omnipotent char", [[META5:![0-9]+]], i64 0}108; CHECK: [[META5]] = !{!"Simple C/C++ TBAA"}109; CHECK: [[META6]] = !{[[META7:![0-9]+]]}110; CHECK: [[META7]] = distinct !{[[META7]], [[META8:![0-9]+]]}111; CHECK: [[META8]] = distinct !{[[META8]], !"LVerDomain"}112; CHECK: [[META9]] = !{[[META10:![0-9]+]]}113; CHECK: [[META10]] = distinct !{[[META10]], [[META8]]}114;.115