; ModuleID = 'test.ibc.opt.1' source_filename = "llvm-link" target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-apple-macosx10.14.0" %struct.__sFILE = type { i8*, i32, i32, i16, i16, %struct.__sbuf, i32, i8*, i32 (i8*)*, i32 (i8*, i8*, i32)*, i64 (i8*, i64, i32)*, i32 (i8*, i8*, i32)*, %struct.__sbuf, %struct.__sFILEX*, i32, [3 x i8], [1 x i8], %struct.__sbuf, i32, i64 } %struct.__sFILEX = type opaque %struct.__sbuf = type { i8*, i32 } @.str = private unnamed_addr constant [11 x i8] c"value: %f\0A\00", align 1 @.str.1 = private unnamed_addr constant [2 x i8] c"r\00", align 1 @.str.2 = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.3 = private unnamed_addr constant [3 x i8] c"%f\00", align 1 @.str.4 = private unnamed_addr constant [18 x i8] c"matrices/%s_a.txt\00", align 1 @.str.5 = private unnamed_addr constant [18 x i8] c"matrices/%s_b.txt\00", align 1 @0 = private unnamed_addr constant [7 x i8] c"-----\0A\00" @1 = private unnamed_addr constant [18 x i8] c"value_before: %f\0A\00" @2 = private unnamed_addr constant [17 x i8] c"value_after: %f\0A\00" @3 = private unnamed_addr constant [9 x i8] c"cmp: %d\0A\00" @4 = private unnamed_addr constant [11 x i8] c"function: \00" @5 = private unnamed_addr constant [9 x i8] c"sampling\00" @6 = private unnamed_addr constant [2 x i8] c"\0A\00" @7 = private unnamed_addr constant [15 x i8] c"cnt value: %d\0A\00" @8 = private unnamed_addr constant [14 x i8] c"eq value: %d\0A\00" @9 = private unnamed_addr constant [15 x i8] c"sub value: %d\0A\00" ; Function Attrs: noinline nounwind ssp uwtable define void @dump_value(float %f) #0 { entry: %conv = fpext float %f to double %call = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), double %conv) #3 ret void } declare i32 @printf(i8*, ...) #1 ; Function Attrs: noinline nounwind ssp uwtable define float* @alloc_matrix(i32 %n) #0 { entry: %conv = sext i32 %n to i64 %mul = shl nsw i64 %conv, 2 %mul2 = mul i64 %mul, %conv %call = call i8* @malloc(i64 %mul2) #4 %tmp = bitcast i8* %call to float* ret float* %tmp } ; Function Attrs: allocsize(0) declare i8* @malloc(i64) #2 ; Function Attrs: noinline nounwind ssp uwtable define i32 @matrix_size(i8* %filename) #0 { entry: %n = alloca i32, align 4 %call = call %struct.__sFILE* @"\01_fopen"(i8* %filename, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0)) #3 %call1 = call i32 (%struct.__sFILE*, i8*, ...) @fscanf(%struct.__sFILE* %call, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* nonnull %n) #3 store i32 %call1, i32* %n, align 4 %call2 = call i32 @fclose(%struct.__sFILE* %call) #3 %tmp = load i32, i32* %n, align 4 ret i32 %tmp } declare %struct.__sFILE* @"\01_fopen"(i8*, i8*) #1 declare i32 @fscanf(%struct.__sFILE*, i8*, ...) #1 declare i32 @fclose(%struct.__sFILE*) #1 ; Function Attrs: noinline nounwind ssp uwtable define float* @read_matrix(i8* %filename, float* %m, i32 %n) #0 { entry: %v = alloca float, align 4 %call = call %struct.__sFILE* @"\01_fopen"(i8* %filename, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0)) #3 store float 0.000000e+00, float* %v, align 4 %tmp = sext i32 %n to i64 %tmp5 = sext i32 %n to i64 br label %for.cond for.cond: ; preds = %for.inc5, %entry %indvars.iv2 = phi i64 [ %indvars.iv.next3, %for.inc5 ], [ 0, %entry ] %cmp = icmp slt i64 %indvars.iv2, %tmp br i1 %cmp, label %for.body, label %for.end7 for.body: ; preds = %for.cond br label %for.cond1 for.cond1: ; preds = %for.inc, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %for.body ] %wide.trip.count = zext i32 %n to i64 %exitcond = icmp ne i64 %indvars.iv, %wide.trip.count br i1 %exitcond, label %for.body3, label %for.end for.body3: ; preds = %for.cond1 %call4 = call i32 (%struct.__sFILE*, i8*, ...) @fscanf(%struct.__sFILE* %call, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), float* nonnull %v) #3 %tmp6 = bitcast float* %v to i32* %tmp7 = load i32, i32* %tmp6, align 4 %tmp8 = mul nsw i64 %indvars.iv2, %tmp5 %tmp9 = add nsw i64 %tmp8, %indvars.iv %arrayidx = getelementptr inbounds float, float* %m, i64 %tmp9 %tmp10 = bitcast float* %arrayidx to i32* store i32 %tmp7, i32* %tmp10, align 4 br label %for.inc for.inc: ; preds = %for.body3 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 br label %for.cond1 for.end: ; preds = %for.cond1 br label %for.inc5 for.inc5: ; preds = %for.end %indvars.iv.next3 = add nuw nsw i64 %indvars.iv2, 1 br label %for.cond for.end7: ; preds = %for.cond %call8 = call i32 @fclose(%struct.__sFILE* %call) #3 ret float* %m } ; Function Attrs: noinline nounwind ssp uwtable define void @matrix_mul(float* noalias %a, float* noalias %b, float* noalias %c, i32 %n) #0 { entry: %call = call i1 @sampling(float* %a, float* %b, float* %c, i32 %n) br i1 %call, label %entry.split.c, label %entry.split entry.split: ; preds = %entry %tmp = sext i32 %n to i64 %tmp13 = sext i32 %n to i64 %tmp14 = sext i32 %n to i64 br label %for.cond for.cond: ; preds = %for.inc20, %entry.split %indvars.iv9 = phi i64 [ %indvars.iv.next10, %for.inc20 ], [ 0, %entry.split ] %cmp = icmp slt i64 %indvars.iv9, %tmp13 br i1 %cmp, label %for.body, label %for.end22 for.body: ; preds = %for.cond br label %for.cond1 for.cond1: ; preds = %for.inc17, %for.body %indvars.iv4 = phi i64 [ %indvars.iv.next5, %for.inc17 ], [ 0, %for.body ] %wide.trip.count7 = zext i32 %n to i64 %exitcond8 = icmp ne i64 %indvars.iv4, %wide.trip.count7 br i1 %exitcond8, label %for.body3, label %for.end19 for.body3: ; preds = %for.cond1 br label %for.cond4 for.cond4: ; preds = %for.inc, %for.body3 %indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %for.body3 ] %wide.trip.count = zext i32 %n to i64 %exitcond = icmp ne i64 %indvars.iv, %wide.trip.count br i1 %exitcond, label %for.body6, label %for.end for.body6: ; preds = %for.cond4 %tmp15 = mul nsw i64 %indvars.iv9, %tmp14 %tmp16 = add nsw i64 %tmp15, %indvars.iv %arrayidx = getelementptr inbounds float, float* %a, i64 %tmp16 %tmp17 = load float, float* %arrayidx, align 4 %tmp18 = mul nsw i64 %indvars.iv, %tmp %tmp19 = add nsw i64 %tmp18, %indvars.iv4 %arrayidx10 = getelementptr inbounds float, float* %b, i64 %tmp19 %tmp20 = load float, float* %arrayidx10, align 4 %mul11 = fmul float %tmp17, %tmp20 %tmp21 = add nsw i64 %tmp15, %indvars.iv4 %arrayidx15 = getelementptr inbounds float, float* %c, i64 %tmp21 %tmp22 = load float, float* %arrayidx15, align 4 %add16 = fadd float %tmp22, %mul11 store float %add16, float* %arrayidx15, align 4 br label %split split: ; preds = %for.body6 br label %for.inc for.inc: ; preds = %split %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 br label %for.cond4 for.end: ; preds = %for.cond4 br label %for.inc17 for.inc17: ; preds = %for.end %indvars.iv.next5 = add nuw nsw i64 %indvars.iv4, 1 br label %for.cond1 for.end19: ; preds = %for.cond1 br label %for.inc20 for.inc20: ; preds = %for.end19 %indvars.iv.next10 = add nuw nsw i64 %indvars.iv9, 1 br label %for.cond for.end22: ; preds = %for.cond.c, %for.cond ret void entry.split.c: ; preds = %entry %tmp.c = sext i32 %n to i64 %tmp13.c = sext i32 %n to i64 %tmp14.c = sext i32 %n to i64 br label %for.cond.c for.cond.c: ; preds = %entry.split.c, %for.inc20.c %indvars.iv9.c = phi i64 [ %indvars.iv.next10.c, %for.inc20.c ], [ 0, %entry.split.c ] %cmp.c = icmp slt i64 %indvars.iv9.c, %tmp13.c br i1 %cmp.c, label %for.body.c, label %for.end22 for.body.c: ; preds = %for.cond.c br label %for.cond1.c for.cond1.c: ; preds = %for.inc17.c, %for.body.c %indvars.iv4.c = phi i64 [ %indvars.iv.next5.c, %for.inc17.c ], [ 0, %for.body.c ] %wide.trip.count7.c = zext i32 %n to i64 %exitcond8.c = icmp ne i64 %indvars.iv4.c, %wide.trip.count7.c br i1 %exitcond8.c, label %for.body3.c, label %for.end19.c for.end19.c: ; preds = %for.cond1.c br label %for.inc20.c for.inc20.c: ; preds = %for.end19.c %indvars.iv.next10.c = add nuw nsw i64 %indvars.iv9.c, 1 br label %for.cond.c for.body3.c: ; preds = %for.cond1.c br label %for.cond4.c for.cond4.c: ; preds = %for.inc.c, %for.body3.c %indvars.iv.c = phi i64 [ %indvars.iv.next.c, %for.inc.c ], [ 0, %for.body3.c ] %wide.trip.count.c = zext i32 %n to i64 %exitcond.c = icmp ne i64 %indvars.iv.c, %wide.trip.count.c br i1 %exitcond.c, label %for.body6.c, label %for.end.c for.end.c: ; preds = %for.cond4.c br label %for.inc17.c for.inc17.c: ; preds = %for.end.c %indvars.iv.next5.c = add nuw nsw i64 %indvars.iv4.c, 1 br label %for.cond1.c for.body6.c: ; preds = %for.cond4.c %tmp15.c = mul nsw i64 %indvars.iv9.c, %tmp14.c %tmp16.c = add nsw i64 %tmp15.c, %indvars.iv.c %arrayidx.c = getelementptr inbounds float, float* %a, i64 %tmp16.c %tmp17.c = load float, float* %arrayidx.c, align 4 %0 = fcmp one float %tmp17.c, 0.000000e+00 br i1 %0, label %1, label %5 ;