brintos

brintos / llvm-project-archived public Read only

0
0
Text · 7.2 KiB · ba81702 Raw
169 lines · plain
1; RUN: llc %s -o - -verify-machineinstrs | FileCheck %s2 3target datalayout = "e-m:o-p:32:32-f64:32:64-v64:32:64-v128:32:128-a:0:32-n32-S32"4target triple = "thumbv7s-apple-ios8.0.0"5 6%struct.cells = type { i32, i32, ptr }7 8@reg_len = external global i32, align 49 10; The thumb2 size reduction pass commutes arguments to make the first src of an add the same as the dest.11; It needs to also move the internal flag when commuting arguments.12 13; CHECK-LABEL: @simulate14 15; Function Attrs: nounwind optsize ssp16define i32 @simulate(i32 %iterations, ptr nocapture %present, double %prob, ptr nocapture readonly %structure) {17entry:18  %0 = load i32, ptr @reg_len, align 4, !tbaa !319  %sub = add nsw i32 %0, -120  %div = sdiv i32 %sub, 3121  %rem2 = srem i32 %sub, 3122  %cmp35202 = icmp sgt i32 %rem2, 023  br label %for.cond3.preheader24 25for.cond3.preheader:                              ; preds = %if.end85, %entry26  %call192 = tail call i32 @lrand48() #227  br label %for.cond6.preheader28 29for.cond34.preheader:                             ; preds = %for.inc3030  br i1 %cmp35202, label %for.body37, label %for.end7331 32for.cond6.preheader:                              ; preds = %for.inc30, %for.cond3.preheader33  %call197 = phi i32 [ %call, %for.inc30 ], [ %call192, %for.cond3.preheader ]34  %i.0196 = phi i32 [ %inc31, %for.inc30 ], [ 0, %for.cond3.preheader ]35  %temp.1195 = phi ptr [ %5, %for.inc30 ], [ %present, %for.cond3.preheader ]36  %savefaulty.0194 = phi i32 [ %add12, %for.inc30 ], [ 0, %for.cond3.preheader ]37  %savef_free.0193 = phi i32 [ %add11, %for.inc30 ], [ 0, %for.cond3.preheader ]38  br label %for.body839 40for.body8:                                        ; preds = %for.body8, %for.cond6.preheader41  %randv.0190 = phi i32 [ %call197, %for.cond6.preheader ], [ %shr, %for.body8 ]42  %j.0189 = phi i32 [ 0, %for.cond6.preheader ], [ %inc, %for.body8 ]43  %temp.2188 = phi ptr [ %temp.1195, %for.cond6.preheader ], [ %5, %for.body8 ]44  %savefaulty.1187 = phi i32 [ %savefaulty.0194, %for.cond6.preheader ], [ %add12, %for.body8 ]45  %savef_free.1186 = phi i32 [ %savef_free.0193, %for.cond6.preheader ], [ %add11, %for.body8 ]46  %1 = load i32, ptr %temp.2188, align 4, !tbaa !747  %add11 = add nsw i32 %1, %savef_free.118648  %faulty = getelementptr inbounds %struct.cells, ptr %temp.2188, i32 0, i32 149  %2 = load i32, ptr %faulty, align 4, !tbaa !1050  %add12 = add nsw i32 %2, %savefaulty.118751  %next = getelementptr inbounds %struct.cells, ptr %temp.2188, i32 0, i32 252  %3 = load ptr, ptr %next, align 4, !tbaa !1153  %4 = load i32, ptr %3, align 4, !tbaa !754  %add14 = add nsw i32 %4, %randv.019055  %and = and i32 %add14, 156  store i32 %and, ptr %temp.2188, align 4, !tbaa !757  %call16 = tail call i32 @lrand48() #258  %rem17 = srem i32 %call16, 100059  %conv18 = sitofp i32 %rem17 to double60  %div19 = fdiv double %conv18, 1.000000e+0361  %cmp20 = fcmp olt double %div19, %prob62  %xor = zext i1 %cmp20 to i3263  %randv.1 = xor i32 %xor, %randv.019064  %5 = load ptr, ptr %next, align 4, !tbaa !1165  %faulty25 = getelementptr inbounds %struct.cells, ptr %5, i32 0, i32 166  %6 = load i32, ptr %faulty25, align 4, !tbaa !1067  %add26 = add nsw i32 %randv.1, %668  %and27 = and i32 %add26, 169  store i32 %and27, ptr %faulty, align 4, !tbaa !1070  %shr = ashr i32 %randv.0190, 171  %inc = add nuw nsw i32 %j.0189, 172  %exitcond = icmp eq i32 %inc, 3173  br i1 %exitcond, label %for.inc30, label %for.body874 75for.inc30:                                        ; preds = %for.body876  %inc31 = add nuw nsw i32 %i.0196, 177  %cmp4 = icmp slt i32 %inc31, %div78  %call = tail call i32 @lrand48() #279  br i1 %cmp4, label %for.cond6.preheader, label %for.cond34.preheader80 81for.body37:                                       ; preds = %for.body37, %for.cond34.preheader82  %randv.2207 = phi i32 [ %shr70, %for.body37 ], [ %call, %for.cond34.preheader ]83  %temp.3205 = phi ptr [ %9, %for.body37 ], [ %5, %for.cond34.preheader ]84  %.pre220 = getelementptr inbounds %struct.cells, ptr %temp.3205, i32 0, i32 185  %next50 = getelementptr inbounds %struct.cells, ptr %temp.3205, i32 0, i32 286  %7 = load ptr, ptr %next50, align 4, !tbaa !1187  %8 = load i32, ptr %7, align 4, !tbaa !788  %add52 = add nsw i32 %8, %randv.220789  %and53 = and i32 %add52, 190  store i32 %and53, ptr %temp.3205, align 4, !tbaa !791  %call55 = tail call i32 @lrand48() #292  %rem56 = srem i32 %call55, 100093  %conv57 = sitofp i32 %rem56 to double94  %div58 = fdiv double %conv57, 1.000000e+0395  %cmp59 = fcmp olt double %div58, %prob96  %xor62 = zext i1 %cmp59 to i3297  %randv.3 = xor i32 %xor62, %randv.220798  %9 = load ptr, ptr %next50, align 4, !tbaa !1199  %faulty65 = getelementptr inbounds %struct.cells, ptr %9, i32 0, i32 1100  %10 = load i32, ptr %faulty65, align 4, !tbaa !10101  %add66 = add nsw i32 %randv.3, %10102  %and67 = and i32 %add66, 1103  store i32 %and67, ptr %.pre220, align 4, !tbaa !10104  %shr70 = ashr i32 %randv.2207, 1105  br label %for.body37106 107for.end73:                                        ; preds = %for.cond34.preheader108  %call74 = tail call i32 @lrand48() #2109  %11 = load i32, ptr @reg_len, align 4, !tbaa !3110  %sub75 = add nsw i32 %11, -1111  %arrayidx76 = getelementptr inbounds i8, ptr %structure, i32 %sub75112  %12 = load i8, ptr %arrayidx76, align 1, !tbaa !12113  %cmp78 = icmp eq i8 %12, 49114  br i1 %cmp78, label %if.then80, label %for.end73.if.end85_crit_edge115 116for.end73.if.end85_crit_edge:                     ; preds = %for.end73117  %.pre222 = getelementptr inbounds %struct.cells, ptr %5, i32 0, i32 1118  br label %if.end85119 120if.then80:                                        ; preds = %for.end73121  %13 = load i32, ptr %5, align 4, !tbaa !7122  %add82 = add nsw i32 %13, %add11123  %faulty83 = getelementptr inbounds %struct.cells, ptr %5, i32 0, i32 1124  %14 = load i32, ptr %faulty83, align 4, !tbaa !10125  %add84 = add nsw i32 %14, %add12126  br label %if.end85127 128if.end85:                                         ; preds = %if.then80, %for.end73.if.end85_crit_edge129  %faulty100.pre-phi = phi ptr [ %.pre222, %for.end73.if.end85_crit_edge ], [ %faulty83, %if.then80 ]130  %savef_free.5 = phi i32 [ %add11, %for.end73.if.end85_crit_edge ], [ %add82, %if.then80 ]131  %savefaulty.5 = phi i32 [ %add12, %for.end73.if.end85_crit_edge ], [ %add84, %if.then80 ]132  %add86 = add nsw i32 %savef_free.5, %call74133  %and87 = and i32 %add86, 1134  store i32 %and87, ptr %5, align 4, !tbaa !7135  %call89 = tail call i32 @lrand48() #2136  %rem90 = srem i32 %call89, 10000137  %conv91 = sitofp i32 %rem90 to double138  %div92 = fdiv double %conv91, 1.000000e+04139  %cmp93 = fcmp olt double %div92, %prob140  %xor96 = zext i1 %cmp93 to i32141  %randv.4 = xor i32 %xor96, %call74142  %add98 = add nsw i32 %randv.4, %savefaulty.5143  %and99 = and i32 %add98, 1144  store i32 %and99, ptr %faulty100.pre-phi, align 4, !tbaa !10145  br label %for.cond3.preheader146}147 148; Function Attrs: optsize149declare i32 @lrand48()150 151attributes #2 = { nounwind optsize }152 153!llvm.module.flags = !{!0, !1}154!llvm.ident = !{!2}155 156!0 = !{i32 1, !"wchar_size", i32 4}157!1 = !{i32 1, !"min_enum_size", i32 4}158!2 = !{!"clang version 3.7.0 (trunk 236243)"}159!3 = !{!4, !4, i64 0}160!4 = !{!"int", !5, i64 0}161!5 = !{!"omnipotent char", !6, i64 0}162!6 = !{!"Simple C/C++ TBAA"}163!7 = !{!8, !4, i64 0}164!8 = !{!"cells", !4, i64 0, !4, i64 4, !9, i64 8}165!9 = !{!"any pointer", !5, i64 0}166!10 = !{!8, !4, i64 4}167!11 = !{!8, !9, i64 8}168!12 = !{!5, !5, i64 0}169