87 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py2; RUN: opt -S -passes=memcpyopt < %s | FileCheck %s3 4; ModuleID = '<stdin>'5source_filename = "test.cpp"6target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"7target triple = "aarch64-unknown-linux-android21"8 9define dso_local void @_Z1ml(i64 %e, i1 %arg) {10; CHECK-LABEL: @_Z1ml(11; CHECK-NEXT: entry:12; CHECK-NEXT: [[L:%.*]] = alloca i8, align 113; CHECK-NEXT: br label [[WHILE_COND:%.*]]14; CHECK: for.cond.while.cond.loopexit_crit_edge.us-lcssa:15; CHECK-NEXT: br label [[WHILE_COND_LOOPEXIT:%.*]]16; CHECK: while.cond.loopexit:17; CHECK-NEXT: [[TMP0:%.*]] = phi ptr [ [[ADD_PTR_I:%.*]], [[FOR_COND_WHILE_COND_LOOPEXIT_CRIT_EDGE_US_LCSSA:%.*]] ], [ [[TMP1:%.*]], [[WHILE_COND]] ]18; CHECK-NEXT: [[I_1_LCSSA:%.*]] = phi ptr [ [[I_2:%.*]], [[FOR_COND_WHILE_COND_LOOPEXIT_CRIT_EDGE_US_LCSSA]] ], [ [[I_0:%.*]], [[WHILE_COND]] ]19; CHECK-NEXT: br label [[WHILE_COND]]20; CHECK: while.cond:21; CHECK-NEXT: [[TMP1]] = phi ptr [ [[L]], [[ENTRY:%.*]] ], [ [[TMP0]], [[WHILE_COND_LOOPEXIT]] ]22; CHECK-NEXT: [[I_0]] = phi ptr [ [[L]], [[ENTRY]] ], [ [[I_1_LCSSA]], [[WHILE_COND_LOOPEXIT]] ]23; CHECK-NEXT: br i1 [[ARG:%.*]], label [[FOR_BODY_LR_PH:%.*]], label [[WHILE_COND_LOOPEXIT]]24; CHECK: for.body.lr.ph:25; CHECK-NEXT: br label [[FOR_BODY:%.*]]26; CHECK: for.body:27; CHECK-NEXT: [[TMP2:%.*]] = phi ptr [ [[TMP1]], [[FOR_BODY_LR_PH]] ], [ [[ADD_PTR_I]], [[IF_END5:%.*]] ]28; CHECK-NEXT: [[I_15:%.*]] = phi ptr [ [[I_0]], [[FOR_BODY_LR_PH]] ], [ [[I_2]], [[IF_END5]] ]29; CHECK-NEXT: [[ADD_PTR_I]] = getelementptr inbounds i8, ptr [[TMP2]], i64 [[E:%.*]]30; CHECK-NEXT: [[TMP3:%.*]] = load i8, ptr [[TMP2]], align 1, !noalias !031; CHECK-NEXT: [[TMP4:%.*]] = load i8, ptr [[I_15]], align 1, !alias.scope !032; CHECK-NEXT: store i8 [[TMP4]], ptr [[TMP2]], align 133; CHECK-NEXT: br label [[_Z1DPCS_L_EXIT:%.*]]34; CHECK: _Z1dPcS_l.exit:35; CHECK-NEXT: br i1 [[ARG]], label [[IF_THEN3:%.*]], label [[IF_END5]]36; CHECK: if.then3:37; CHECK-NEXT: [[ADD_PTR4:%.*]] = getelementptr inbounds i8, ptr [[I_15]], i64 [[E]]38; CHECK-NEXT: br label [[IF_END5]]39; CHECK: if.end5:40; CHECK-NEXT: [[I_2]] = phi ptr [ [[ADD_PTR4]], [[IF_THEN3]] ], [ [[I_15]], [[_Z1DPCS_L_EXIT]] ]41; CHECK-NEXT: br i1 false, label [[FOR_BODY]], label [[FOR_COND_WHILE_COND_LOOPEXIT_CRIT_EDGE_US_LCSSA]]42;43entry:44 %l = alloca i8, align 145 br label %while.cond46 47for.cond.while.cond.loopexit_crit_edge.us-lcssa: ; preds = %if.end548 br label %while.cond.loopexit49 50while.cond.loopexit: ; preds = %while.cond, %for.cond.while.cond.loopexit_crit_edge.us-lcssa51 %0 = phi ptr [ %add.ptr.i, %for.cond.while.cond.loopexit_crit_edge.us-lcssa ], [ %1, %while.cond ]52 %i.1.lcssa = phi ptr [ %i.2, %for.cond.while.cond.loopexit_crit_edge.us-lcssa ], [ %i.0, %while.cond ]53 br label %while.cond54 55while.cond: ; preds = %while.cond.loopexit, %entry56 %1 = phi ptr [ %l, %entry ], [ %0, %while.cond.loopexit ]57 %i.0 = phi ptr [ %l, %entry ], [ %i.1.lcssa, %while.cond.loopexit ]58 br i1 %arg, label %for.body.lr.ph, label %while.cond.loopexit59 60for.body.lr.ph: ; preds = %while.cond61 br label %for.body62 63for.body: ; preds = %if.end5, %for.body.lr.ph64 %2 = phi ptr [ %1, %for.body.lr.ph ], [ %add.ptr.i, %if.end5 ]65 %i.15 = phi ptr [ %i.0, %for.body.lr.ph ], [ %i.2, %if.end5 ]66 %add.ptr.i = getelementptr inbounds i8, ptr %2, i64 %e67 %3 = load i8, ptr %2, align 1, !noalias !068 %4 = load i8, ptr %i.15, align 1, !alias.scope !069 store i8 %4, ptr %2, align 170 br label %_Z1dPcS_l.exit71 72_Z1dPcS_l.exit: ; preds = %for.body73 br i1 %arg, label %if.then3, label %if.end574 75if.then3: ; preds = %_Z1dPcS_l.exit76 %add.ptr4 = getelementptr inbounds i8, ptr %i.15, i64 %e77 br label %if.end578 79if.end5: ; preds = %if.then3, %_Z1dPcS_l.exit80 %i.2 = phi ptr [ %add.ptr4, %if.then3 ], [ %i.15, %_Z1dPcS_l.exit ]81 br i1 false, label %for.body, label %for.cond.while.cond.loopexit_crit_edge.us-lcssa82}83 84!0 = !{!1}85!1 = distinct !{!1, !2, !"_Z1dPcS_l: %h"}86!2 = distinct !{!2, !"_Z1dPcS_l"}87