Skip to content

Instantly share code, notes, and snippets.

@annanay25
Created July 4, 2017 11:10
Show Gist options
  • Save annanay25/f44656ef1a4d5719374e4e3a735a977a to your computer and use it in GitHub Desktop.
Save annanay25/f44656ef1a4d5719374e4e3a735a977a to your computer and use it in GitHub Desktop.
*-polly-process-unprofitable* version of - Resultant [2,2] matrix on multiplication of [2,784] x [784,2]
; ModuleID = '__compute_module'
source_filename = "__compute_module"
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux_gnu"
; Function Attrs: norecurse nounwind
define void @"cluster_2[_XlaCompiledKernel=true,_XlaNumConstantArgs=0].v5"(i8* nocapture align 16 dereferenceable(16) %retval, i8* noalias nocapture readnone %run_options, i8** noalias nocapture readonly %params, i8** noalias nocapture readnone %temps, i64* noalias nocapture readnone %prof_counters) local_unnamed_addr #0 {
entry:
%0 = getelementptr inbounds i8*, i8** %params, i64 1
%1 = load i8*, i8** %0, align 8, !tbaa !0, !dereferenceable !3, !align !4
%2 = load i8*, i8** %params, align 8, !tbaa !5, !dereferenceable !3, !align !4
br label %polly.loop_header
polly.exiting: ; preds = %polly.loop_exit44
ret void
polly.loop_header: ; preds = %polly.loop_exit44, %entry
%accum_address.0.s2a.0 = phi float [ undef, %entry ], [ %accum_address.0.s2a.1, %polly.loop_exit44 ]
%accum_address.0.phiops.0 = phi float [ undef, %entry ], [ %accum_address.0.phiops.1, %polly.loop_exit44 ]
%polly.indvar = phi i64 [ 0, %entry ], [ %polly.indvar_next, %polly.loop_exit44 ]
%pexp.pdiv_r = urem i64 %polly.indvar, 785
%3 = icmp eq i64 %pexp.pdiv_r, 0
br i1 %3, label %polly.cond23, label %polly.then
polly.merge.loopexit: ; preds = %polly.merge12.1, %polly.merge12
%accum_address.0.phiops.5.lcssa = phi float [ %accum_address.0.phiops.5, %polly.merge12 ], [ %accum_address.0.phiops.5.1, %polly.merge12.1 ]
br label %polly.merge
polly.merge: ; preds = %polly.merge.loopexit, %polly.cond32, %polly.then
%.pre-phi = phi i64 [ %.pre61, %polly.cond32 ], [ %8, %polly.then ], [ %8, %polly.merge.loopexit ]
%accum_address.0.phiops.1 = phi float [ %.accum_address.0.phiops.0, %polly.cond32 ], [ %accum_address.0.phiops.0, %polly.then ], [ %accum_address.0.phiops.5.lcssa, %polly.merge.loopexit ]
%4 = icmp sgt i64 %.pre-phi, 0
%5 = select i1 %4, i64 %.pre-phi, i64 0
%6 = icmp ugt i64 %polly.indvar, 784
%7 = zext i1 %6 to i64
%polly.loop_guard45 = icmp sgt i64 %5, %7
br i1 %polly.loop_guard45, label %polly.loop_exit44, label %polly.loop_header42.preheader
polly.loop_header42.preheader: ; preds = %polly.merge
br label %polly.loop_header42
polly.loop_exit44.loopexit: ; preds = %polly.loop_header42.1, %polly.loop_header42
%accum_address.0.phiops.1.accum_address.0.s2a.2.lcssa = phi float [ %accum_address.0.phiops.1.accum_address.0.s2a.2, %polly.loop_header42 ], [ %accum_address.0.phiops.1.accum_address.0.s2a.2.1, %polly.loop_header42.1 ]
br label %polly.loop_exit44
polly.loop_exit44: ; preds = %polly.loop_exit44.loopexit, %polly.merge
%accum_address.0.s2a.1 = phi float [ %accum_address.0.s2a.0, %polly.merge ], [ %accum_address.0.phiops.1.accum_address.0.s2a.2.lcssa, %polly.loop_exit44.loopexit ]
%polly.indvar_next = add nuw nsw i64 %polly.indvar, 1
%exitcond = icmp eq i64 %polly.indvar_next, 3141
br i1 %exitcond, label %polly.exiting, label %polly.loop_header
polly.then: ; preds = %polly.loop_header
%pexp.p_div_q = udiv i64 %polly.indvar, 785
%8 = add nsw i64 %pexp.p_div_q, -2
%9 = icmp sgt i64 %8, 0
%10 = select i1 %9, i64 %8, i64 0
%11 = add nsw i64 %polly.indvar, -1
%12 = icmp ugt i64 %11, 784
%13 = zext i1 %12 to i64
%polly.loop_guard = icmp sgt i64 %10, %13
br i1 %polly.loop_guard, label %polly.merge, label %polly.loop_header5.preheader
polly.loop_header5.preheader: ; preds = %polly.then
%not.59 = xor i1 %12, true
%polly.adjust_ub = sext i1 %not.59 to i64
br label %polly.loop_header5
polly.cond23: ; preds = %polly.loop_header
%14 = icmp sgt i64 %polly.indvar, 784
%pexp.div60 = udiv i64 %polly.indvar, 785
br i1 %14, label %polly.stmt.loop_exit.reduction, label %polly.cond32
polly.cond32: ; preds = %polly.cond23, %polly.stmt.loop_exit.reduction
%15 = icmp slt i64 %polly.indvar, 2356
%.accum_address.0.phiops.0 = select i1 %15, float 0.000000e+00, float %accum_address.0.phiops.0
%.pre61 = add nsw i64 %pexp.div60, -2
br label %polly.merge
polly.loop_header5: ; preds = %polly.loop_header5.preheader
%16 = mul i64 %10, -785
%17 = add i64 %16, %polly.indvar
%18 = add nsw i64 %17, 785
%pexp.pdiv_r15 = urem i64 %18, 1570
%19 = icmp ugt i64 %pexp.pdiv_r15, 784
br i1 %19, label %polly.then13, label %polly.merge12
polly.merge12: ; preds = %polly.loop_header5, %polly.then13
%accum_address.0.phiops.5 = phi float [ %p_22, %polly.then13 ], [ %accum_address.0.phiops.0, %polly.loop_header5 ]
%polly.indvar_next9 = add nuw nsw i64 %10, 1
%polly.loop_cond10 = icmp sgt i64 %10, %polly.adjust_ub
br i1 %polly.loop_cond10, label %polly.merge.loopexit, label %polly.loop_header5.1
polly.then13: ; preds = %polly.loop_header5
%20 = add nsw i64 %17, -1
%pexp.pdiv_r17 = urem i64 %20, 1570
%21 = mul nsw i64 %10, 785
%22 = add i64 %11, %21
%pexp.p_div_q16 = udiv i64 %22, 1570
%23 = sub nsw i64 %pexp.p_div_q16, %10
%24 = mul i64 %23, 3136
%25 = shl nuw nsw i64 %pexp.pdiv_r17, 2
%26 = add i64 %24, %25
%scevgep = getelementptr i8, i8* %1, i64 %26
%scevgep18 = bitcast i8* %scevgep to float*
%_p_scalar_ = load float, float* %scevgep18, align 4, !alias.scope !7, !noalias !9
%27 = shl nuw nsw i64 %pexp.pdiv_r17, 3
%28 = shl nsw i64 %10, 2
%29 = add nuw nsw i64 %27, %28
%scevgep19 = getelementptr i8, i8* %2, i64 %29
%scevgep1920 = bitcast i8* %scevgep19 to float*
%_p_scalar_21 = load float, float* %scevgep1920, align 4, !alias.scope !12, !noalias !13
%p_ = fmul fast float %_p_scalar_21, %_p_scalar_
%p_22 = fadd fast float %p_, %accum_address.0.s2a.0
br label %polly.merge12
polly.stmt.loop_exit.reduction: ; preds = %polly.cond23
%30 = add nsw i64 %polly.indvar, -1
%pexp.p_div_q28 = udiv i64 %30, 1570
%31 = shl nuw nsw i64 %pexp.p_div_q28, 1
%32 = sub nsw i64 %pexp.div60, %31
%33 = shl nuw nsw i64 %pexp.p_div_q28, 3
%34 = shl nsw i64 %32, 2
%35 = add nsw i64 %33, -4
%36 = add nsw i64 %35, %34
%scevgep30 = getelementptr i8, i8* %retval, i64 %36
%scevgep3031 = bitcast i8* %scevgep30 to float*
store float %accum_address.0.s2a.0, float* %scevgep3031, align 4, !alias.scope !11, !noalias !14
br label %polly.cond32
polly.loop_header42: ; preds = %polly.loop_header42.preheader
%37 = add nuw nsw i64 %polly.indvar, 785
%not. = xor i1 %6, true
%polly.adjust_ub48 = sext i1 %not. to i64
%38 = mul i64 %5, -785
%39 = add i64 %37, %38
%pexp.pdiv_r54 = urem i64 %39, 1570
%40 = icmp ugt i64 %pexp.pdiv_r54, 784
%accum_address.0.phiops.1.accum_address.0.s2a.2 = select i1 %40, float %accum_address.0.phiops.1, float %accum_address.0.s2a.0
%polly.loop_cond49 = icmp sgt i64 %5, %polly.adjust_ub48
br i1 %polly.loop_cond49, label %polly.loop_exit44.loopexit, label %polly.loop_header42.1
polly.loop_header5.1: ; preds = %polly.merge12
%41 = mul i64 %polly.indvar_next9, -785
%42 = add i64 %41, %polly.indvar
%43 = add nsw i64 %42, 785
%pexp.pdiv_r15.1 = urem i64 %43, 1570
%44 = icmp ugt i64 %pexp.pdiv_r15.1, 784
br i1 %44, label %polly.then13.1, label %polly.merge12.1
polly.then13.1: ; preds = %polly.loop_header5.1
%45 = add nsw i64 %42, -1
%pexp.pdiv_r17.1 = urem i64 %45, 1570
%46 = mul nsw i64 %polly.indvar_next9, 785
%47 = add i64 %11, %46
%pexp.p_div_q16.1 = udiv i64 %47, 1570
%48 = sub nsw i64 %pexp.p_div_q16.1, %polly.indvar_next9
%49 = mul i64 %48, 3136
%50 = shl nuw nsw i64 %pexp.pdiv_r17.1, 2
%51 = add i64 %49, %50
%scevgep.1 = getelementptr i8, i8* %1, i64 %51
%scevgep18.1 = bitcast i8* %scevgep.1 to float*
%_p_scalar_.1 = load float, float* %scevgep18.1, align 4, !alias.scope !7, !noalias !9
%52 = shl nuw nsw i64 %pexp.pdiv_r17.1, 3
%53 = shl nsw i64 %polly.indvar_next9, 2
%54 = add nuw nsw i64 %52, %53
%scevgep19.1 = getelementptr i8, i8* %2, i64 %54
%scevgep1920.1 = bitcast i8* %scevgep19.1 to float*
%_p_scalar_21.1 = load float, float* %scevgep1920.1, align 4, !alias.scope !12, !noalias !13
%p_.1 = fmul fast float %_p_scalar_21.1, %_p_scalar_.1
%p_22.1 = fadd fast float %p_.1, %accum_address.0.s2a.0
br label %polly.merge12.1
polly.merge12.1: ; preds = %polly.then13.1, %polly.loop_header5.1
%accum_address.0.phiops.5.1 = phi float [ %p_22.1, %polly.then13.1 ], [ %accum_address.0.phiops.5, %polly.loop_header5.1 ]
br label %polly.merge.loopexit
polly.loop_header42.1: ; preds = %polly.loop_header42
%55 = mul i64 %5, -785
%56 = add i64 %polly.indvar, %55
%pexp.pdiv_r54.1 = urem i64 %56, 1570
%57 = icmp ugt i64 %pexp.pdiv_r54.1, 784
%accum_address.0.phiops.1.accum_address.0.s2a.2.1 = select i1 %57, float %accum_address.0.phiops.1, float %accum_address.0.phiops.1.accum_address.0.s2a.2
br label %polly.loop_exit44.loopexit
}
attributes #0 = { norecurse nounwind "polly-optimized" }
!0 = !{!1, !1, i64 0}
!1 = !{!"pointer-to element_type: F32 dimensions: 2 dimensions: 784 layout { minor_to_major: 1 minor_to_major: 0 }", !2}
!2 = !{!"XLA TBAA"}
!3 = !{i64 6272}
!4 = !{i64 16}
!5 = !{!6, !6, i64 0}
!6 = !{!"pointer-to element_type: F32 dimensions: 784 dimensions: 2 layout { minor_to_major: 1 minor_to_major: 0 }", !2}
!7 = distinct !{!7, !8, !"polly.alias.scope."}
!8 = distinct !{!8, !"polly.alias.scope.domain"}
!9 = !{!10, !11, !12}
!10 = distinct !{!10, !8, !"polly.alias.scope.accum_address.0"}
!11 = distinct !{!11, !8, !"polly.alias.scope.retval"}
!12 = distinct !{!12, !8, !"polly.alias.scope."}
!13 = !{!10, !11, !7}
!14 = !{!10, !12, !7}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment