Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix unnecessary transpose usage #1507

Merged
merged 1 commit into from
Oct 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions enzyme/test/Enzyme/ReverseMode/blas/gemm_f.ll
Original file line number Diff line number Diff line change
Expand Up @@ -90,16 +90,8 @@ entry:
; CHECK-NEXT: br label %invertentry

; CHECK: invertentry: ; preds = %entry
; CHECK-NEXT: %ld.transa = load i8, i8* %transa
; CHECK-DAG: %[[i10:.+]] = icmp eq i8 %ld.transa, 110
; CHECK-DAG: %[[i11:.+]] = select i1 %[[i10]], i8 116, i8 0
; CHECK-DAG: %[[i12:.+]] = icmp eq i8 %ld.transa, 78
; CHECK-DAG: %[[i13:.+]] = select i1 %[[i12]], i8 84, i8 %[[i11]]
; CHECK-DAG: %[[i14:.+]] = icmp eq i8 %ld.transa, 116
; CHECK-DAG: %[[i15:.+]] = select i1 %[[i14]], i8 110, i8 %[[i13]]
; CHECK-DAG: %[[i16:.+]] = icmp eq i8 %ld.transa, 84
; CHECK-DAG: %[[i17:.+]] = select i1 %[[i16]], i8 78, i8 %[[i15]]
; CHECK-NEXT: store i8 %[[i17]], i8* %byref.transpose.transa
; CHECK-NEXT: store i64 1, i64* %byref.int.one
; CHECK-NEXT: %intcast.int.one = bitcast i64* %byref.int.one to i8*
; CHECK-NEXT: %ld.transb = load i8, i8* %transb
; CHECK-DAG: %[[i18:.+]] = icmp eq i8 %ld.transb, 110
; CHECK-DAG: %[[i19:.+]] = select i1 %[[i18:.+]], i8 116, i8 0
Expand All @@ -110,8 +102,6 @@ entry:
; CHECK-DAG: %[[i24:.+]] = icmp eq i8 %ld.transb, 84
; CHECK-DAG: %[[i25:.+]] = select i1 %[[i24:.+]], i8 78, i8 %[[i23]]
; CHECK-NEXT: store i8 %[[i25]], i8* %byref.transpose.transb
; CHECK-NEXT: store i64 1, i64* %byref.int.one
; CHECK-NEXT: %intcast.int.one = bitcast i64* %byref.int.one to i8*
; CHECK-NEXT: %ld.row.trans = load i8, i8* %transa, align 1
; CHECK-NEXT: %[[a16:.+]] = icmp eq i8 %ld.row.trans, 110
; CHECK-NEXT: %[[a17:.+]] = icmp eq i8 %ld.row.trans, 78
Expand All @@ -131,6 +121,16 @@ entry:
; CHECK-NEXT: store double 1.000000e+00, double* %[[byref_fp_1]], align 8
; CHECK-NEXT: %[[fpcast_1:.+]] = bitcast double* %[[byref_fp_1]] to i8*
; CHECK-NEXT: call void @dgemm_64_(i8* %[[a19]], i8* %[[a20]], i8* %[[a21]], i8* %[[a22]], i8* %n_p, i8* %alpha_p, i8* %[[a26]], i8* %[[a27]], i8* %[[a28]], i8* %[[a29]], i8* %[[fpcast_1]], i8* %"A'", i8* %lda_p, i64 1, i64 1)
; CHECK-NEXT: %ld.transa = load i8, i8* %transa
; CHECK-DAG: %[[i10:.+]] = icmp eq i8 %ld.transa, 110
; CHECK-DAG: %[[i11:.+]] = select i1 %[[i10]], i8 116, i8 0
; CHECK-DAG: %[[i12:.+]] = icmp eq i8 %ld.transa, 78
; CHECK-DAG: %[[i13:.+]] = select i1 %[[i12]], i8 84, i8 %[[i11]]
; CHECK-DAG: %[[i14:.+]] = icmp eq i8 %ld.transa, 116
; CHECK-DAG: %[[i15:.+]] = select i1 %[[i14]], i8 110, i8 %[[i13]]
; CHECK-DAG: %[[i16:.+]] = icmp eq i8 %ld.transa, 84
; CHECK-DAG: %[[i17:.+]] = select i1 %[[i16]], i8 78, i8 %[[i15]]
; CHECK-NEXT: store i8 %[[i17]], i8* %byref.transpose.transa
; CHECK-NEXT: %[[ld_row_trans2:.+]] = load i8, i8* %transb, align 1
; CHECK-NEXT: %[[a30:.+]] = icmp eq i8 %[[ld_row_trans2]], 110
; CHECK-NEXT: %[[a31:.+]] = icmp eq i8 %[[ld_row_trans2]], 78
Expand Down
28 changes: 14 additions & 14 deletions enzyme/test/Enzyme/ReverseMode/blas/gemm_f_c.ll
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ entry:
; CHECK: define internal void @diffef(i8* %C, i8* %"C'", i8* %A, i8* %"A'", i8* %B, i8* %"B'")
; CHECK-NEXT: entry:
; CHECK-NEXT: %ret = alloca double
; CHECK-NEXT: %byref.transpose.transa = alloca i8
; CHECK-NEXT: %byref.transpose.transb = alloca i8
; CHECK-NEXT: %byref.int.one = alloca i64
; CHECK-NEXT: %byref.transpose.transb = alloca i8
; CHECK-NEXT: %byref.constant.fp.1.0 = alloca double, align 8
; CHECK-NEXT: %byref.transpose.transa = alloca i8
; CHECK-NEXT: %[[byref_fp_1_013:.+]] = alloca double, align 8
; CHECK-NEXT: %byref.constant.char.G = alloca i8, align 1
; CHECK-NEXT: %byref.constant.int.0 = alloca i64, align 8
Expand Down Expand Up @@ -188,16 +188,8 @@ entry:
; CHECK-NEXT: store double 0.000000e+00, double* %"ptr'ipc", align 8, !alias.scope !13, !noalias !10
; CHECK-NEXT: %[[i42:.+]] = bitcast double* %cache.A to i8*
; CHECK-NEXT: %[[i43:.+]] = bitcast double* %cache.B to i8*
; CHECK-NEXT: %ld.transa = load i8, i8* %transa
; CHECK-DAG: %[[r0:.+]] = icmp eq i8 %ld.transa, 110
; CHECK-DAG: %[[r1:.+]] = select i1 %[[r0]], i8 116, i8 0
; CHECK-DAG: %[[r2:.+]] = icmp eq i8 %ld.transa, 78
; CHECK-DAG: %[[r3:.+]] = select i1 %[[r2]], i8 84, i8 %[[r1]]
; CHECK-DAG: %[[r4:.+]] = icmp eq i8 %ld.transa, 116
; CHECK-DAG: %[[r5:.+]] = select i1 %[[r4]], i8 110, i8 %[[r3]]
; CHECK-DAG: %[[r6:.+]] = icmp eq i8 %ld.transa, 84
; CHECK-DAG: %[[r7:.+]] = select i1 %[[r6]], i8 78, i8 %[[r5]]
; CHECK-NEXT: store i8 %[[r7]], i8* %byref.transpose.transa
; CHECK-NEXT: store i64 1, i64* %byref.int.one
; CHECK-NEXT: %intcast.int.one = bitcast i64* %byref.int.one to i8*
; CHECK-NEXT: %ld.transb = load i8, i8* %transb
; CHECK-DAG: %[[r8:.+]] = icmp eq i8 %ld.transb, 110
; CHECK-DAG: %[[r9:.+]] = select i1 %[[r8]], i8 116, i8 0
Expand All @@ -208,8 +200,6 @@ entry:
; CHECK-DAG: %[[r14:.+]] = icmp eq i8 %ld.transb, 84
; CHECK-DAG: %[[r15:.+]] = select i1 %[[r14]], i8 78, i8 %[[r13]]
; CHECK-NEXT: store i8 %[[r15]], i8* %byref.transpose.transb
; CHECK-NEXT: store i64 1, i64* %byref.int.one
; CHECK-NEXT: %intcast.int.one = bitcast i64* %byref.int.one to i8*
; CHECK-NEXT: %ld.row.trans = load i8, i8* %transa, align 1
; CHECK-NEXT: %[[r58:.+]] = icmp eq i8 %ld.row.trans, 110
; CHECK-NEXT: %[[r59:.+]] = icmp eq i8 %ld.row.trans, 78
Expand Down Expand Up @@ -239,6 +229,16 @@ entry:
; CHECK-NEXT: store double 1.000000e+00, double* %byref.constant.fp.1.0, align 8
; CHECK-NEXT: %fpcast.constant.fp.1.0 = bitcast double* %byref.constant.fp.1.0 to i8*
; CHECK-NEXT: call void @dgemm_64_(i8* %[[r61]], i8* %[[r62]], i8* %[[r63]], i8* %[[r64]], i8* %n_p, i8* %alpha_p, i8* %[[r76]], i8* %[[r77]], i8* %[[r78]], i8* %[[r79]], i8* %fpcast.constant.fp.1.0, i8* %"A'", i8* %lda_p, i64 1, i64 1)
; CHECK-NEXT: %ld.transa = load i8, i8* %transa
; CHECK-DAG: %[[r0:.+]] = icmp eq i8 %ld.transa, 110
; CHECK-DAG: %[[r1:.+]] = select i1 %[[r0]], i8 116, i8 0
; CHECK-DAG: %[[r2:.+]] = icmp eq i8 %ld.transa, 78
; CHECK-DAG: %[[r3:.+]] = select i1 %[[r2]], i8 84, i8 %[[r1]]
; CHECK-DAG: %[[r4:.+]] = icmp eq i8 %ld.transa, 116
; CHECK-DAG: %[[r5:.+]] = select i1 %[[r4]], i8 110, i8 %[[r3]]
; CHECK-DAG: %[[r6:.+]] = icmp eq i8 %ld.transa, 84
; CHECK-DAG: %[[r7:.+]] = select i1 %[[r6]], i8 78, i8 %[[r5]]
; CHECK-NEXT: store i8 %[[r7]], i8* %byref.transpose.transa
; CHECK-NEXT: %[[ld_row_trans9:.+]] = load i8, i8* %transb, align 1
; CHECK-NEXT: %[[r80:.+]] = icmp eq i8 %[[ld_row_trans9]], 110
; CHECK-NEXT: %[[r81:.+]] = icmp eq i8 %[[ld_row_trans9]], 78
Expand Down
44 changes: 22 additions & 22 deletions enzyme/test/Enzyme/ReverseMode/blas/gemm_f_c_lacpy_runtime_act.ll
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,12 @@ entry:
; CHECK-NEXT: %[[byrefgarbage:.+]] = alloca i8
; CHECK-NEXT: %[[byrefgarbage2:.+]] = alloca i8
; CHECK-NEXT: %ret = alloca double
; CHECK-NEXT: %byref.transpose.transa = alloca i8
; CHECK-NEXT: %byref.transpose.transb = alloca i8
; CHECK-NEXT: %byref.int.one = alloca i64
; CHECK-NEXT: %byref.constant.fp.1.0 = alloca double
; CHECK-NEXT: %byref.constant.fp.0.0 = alloca double
; CHECK-NEXT: %byref.transpose.transb = alloca i8
; CHECK-NEXT: %byref.constant.fp.1.09 = alloca double, align 8
; CHECK-NEXT: %byref.transpose.transa = alloca i8
; CHECK-NEXT: %[[byref_fp_1_017:.+]] = alloca double, align 8
; CHECK-NEXT: %byref.constant.char.G = alloca i8, align 1
; CHECK-NEXT: %byref.constant.int.0 = alloca i64, align 8
Expand Down Expand Up @@ -140,26 +140,6 @@ entry:
; CHECK-NEXT: %[[matA:.+]] = bitcast double* %cache.A to i8*
; CHECK-NEXT: %[[matC0:.+]] = bitcast double* %cache.C to i8*
; CHECK-NEXT: %[[matC:.+]] = bitcast double* %cache.C to i8*
; CHECK-NEXT: %ld.transa = load i8, i8* %transa
; CHECK-DAG: %[[i25:.+]] = icmp eq i8 %ld.transa, 110
; CHECK-DAG: %[[i26:.+]] = select i1 %[[i25]], i8 116, i8 0
; CHECK-DAG: %[[i27:.+]] = icmp eq i8 %ld.transa, 78
; CHECK-DAG: %[[i28:.+]] = select i1 %[[i27]], i8 84, i8 %[[i26]]
; CHECK-DAG: %[[i29:.+]] = icmp eq i8 %ld.transa, 116
; CHECK-DAG: %[[i30:.+]] = select i1 %[[i29]], i8 110, i8 %[[i28]]
; CHECK-DAG: %[[i31:.+]] = icmp eq i8 %ld.transa, 84
; CHECK-DAG: %[[i32:.+]] = select i1 %[[i31]], i8 78, i8 %[[i30]]
; CHECK-NEXT: store i8 %[[i32]], i8* %byref.transpose.transa
; CHECK-NEXT: %ld.transb = load i8, i8* %transb
; CHECK-DAG: %[[i33:.+]] = icmp eq i8 %ld.transb, 110
; CHECK-DAG: %[[i34:.+]] = select i1 %[[i33]], i8 116, i8 0
; CHECK-DAG: %[[i35:.+]] = icmp eq i8 %ld.transb, 78
; CHECK-DAG: %[[i36:.+]] = select i1 %[[i35]], i8 84, i8 %[[i34]]
; CHECK-DAG: %[[i37:.+]] = icmp eq i8 %ld.transb, 116
; CHECK-DAG: %[[i38:.+]] = select i1 %[[i37]], i8 110, i8 %[[i36]]
; CHECK-DAG: %[[i39:.+]] = icmp eq i8 %ld.transb, 84
; CHECK-DAG: %[[i40:.+]] = select i1 %[[i39]], i8 78, i8 %[[i38]]
; CHECK-NEXT: store i8 %[[i40]], i8* %byref.transpose.transb
; CHECK-NEXT: store i64 1, i64* %byref.int.one
; CHECK-NEXT: %intcast.int.one = bitcast i64* %byref.int.one to i8*
; CHECK-NEXT: br i1 %rt.inactive.alpha, label %invertentry.alpha.done, label %invertentry.alpha.active
Expand Down Expand Up @@ -228,6 +208,16 @@ entry:
; CHECK-NEXT: br i1 %rt.inactive.A, label %invertentry.A.done, label %invertentry.A.active

; CHECK: invertentry.A.active: ; preds = %invertentry.alpha.done
; CHECK-NEXT: %ld.transb = load i8, i8* %transb
; CHECK-DAG: %[[i33:.+]] = icmp eq i8 %ld.transb, 110
; CHECK-DAG: %[[i34:.+]] = select i1 %[[i33]], i8 116, i8 0
; CHECK-DAG: %[[i35:.+]] = icmp eq i8 %ld.transb, 78
; CHECK-DAG: %[[i36:.+]] = select i1 %[[i35]], i8 84, i8 %[[i34]]
; CHECK-DAG: %[[i37:.+]] = icmp eq i8 %ld.transb, 116
; CHECK-DAG: %[[i38:.+]] = select i1 %[[i37]], i8 110, i8 %[[i36]]
; CHECK-DAG: %[[i39:.+]] = icmp eq i8 %ld.transb, 84
; CHECK-DAG: %[[i40:.+]] = select i1 %[[i39]], i8 78, i8 %[[i38]]
; CHECK-NEXT: store i8 %[[i40]], i8* %byref.transpose.transb
; CHECK-NEXT: %ld.row.trans = load i8, i8* %transa, align 1
; CHECK-NEXT: %[[r62:.+]] = icmp eq i8 %ld.row.trans, 110
; CHECK-NEXT: %[[r63:.+]] = icmp eq i8 %ld.row.trans, 78
Expand All @@ -253,6 +243,16 @@ entry:
; CHECK-NEXT: br i1 %rt.inactive.B, label %invertentry.B.done, label %invertentry.B.active

; CHECK: invertentry.B.active: ; preds = %invertentry.A.done
; CHECK-NEXT: %ld.transa = load i8, i8* %transa
; CHECK-DAG: %[[i25:.+]] = icmp eq i8 %ld.transa, 110
; CHECK-DAG: %[[i26:.+]] = select i1 %[[i25]], i8 116, i8 0
; CHECK-DAG: %[[i27:.+]] = icmp eq i8 %ld.transa, 78
; CHECK-DAG: %[[i28:.+]] = select i1 %[[i27]], i8 84, i8 %[[i26]]
; CHECK-DAG: %[[i29:.+]] = icmp eq i8 %ld.transa, 116
; CHECK-DAG: %[[i30:.+]] = select i1 %[[i29]], i8 110, i8 %[[i28]]
; CHECK-DAG: %[[i31:.+]] = icmp eq i8 %ld.transa, 84
; CHECK-DAG: %[[i32:.+]] = select i1 %[[i31]], i8 78, i8 %[[i30]]
; CHECK-NEXT: store i8 %[[i32]], i8* %byref.transpose.transa
; CHECK-NEXT: %[[ld_row_trans13:.+]] = load i8, i8* %transb, align 1
; CHECK-NEXT: %[[r76:.+]] = icmp eq i8 %[[ld_row_trans13]], 110
; CHECK-NEXT: %[[r77:.+]] = icmp eq i8 %[[ld_row_trans13]], 78
Expand Down
17 changes: 3 additions & 14 deletions enzyme/test/Enzyme/ReverseMode/blas/gemm_f_c_loop.ll
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,8 @@ entry:
; CHECK-NEXT: %byref.ldc = alloca i64
; CHECK-NEXT: %ret = alloca double
; CHECK-NEXT: %m_p_cache = alloca i8*, align 8
; CHECK-NEXT: %byref.transpose.transa = alloca i8
; CHECK-NEXT: %byref.transpose.transb = alloca i8
; CHECK-NEXT: %byref.int.one = alloca i64
; CHECK-NEXT: %byref.transpose.transa = alloca i8
; CHECK-NEXT: %byref.constant.fp.1.0 = alloca double, align 8
; CHECK-NEXT: %byref.constant.char.G = alloca i8, align 1
; CHECK-NEXT: %byref.constant.int.0 = alloca i64, align 8
Expand Down Expand Up @@ -248,6 +247,8 @@ entry:
; CHECK-NEXT: %[[r37:.+]] = load i8*, i8** %m_p_cache, align 8, !invariant.group !6
; CHECK-NEXT: %[[r38:.+]] = load i64, i64* %"iv'ac"
; CHECK-NEXT: %n_p_unwrap = bitcast i64* %n to i8*
; CHECK-NEXT: store i64 1, i64* %byref.int.one
; CHECK-NEXT: %intcast.int.one = bitcast i64* %byref.int.one to i8*
; CHECK-NEXT: %ld.transa = load i8, i8* %byref.transa
; CHECK-DAG: %[[r0:.+]] = icmp eq i8 %ld.transa, 110
; CHECK-DAG: %[[r1:.+]] = select i1 %[[r0]], i8 116, i8 0
Expand All @@ -258,18 +259,6 @@ entry:
; CHECK-DAG: %[[r6:.+]] = icmp eq i8 %ld.transa, 84
; CHECK-DAG: %[[r7:.+]] = select i1 %[[r6]], i8 78, i8 %[[r5]]
; CHECK-NEXT: store i8 %[[r7]], i8* %byref.transpose.transa
; CHECK-NEXT: %ld.transb = load i8, i8* %byref.transb
; CHECK-DAG: %[[r8:.+]] = icmp eq i8 %ld.transb, 110
; CHECK-DAG: %[[r9:.+]] = select i1 %[[r8]], i8 116, i8 0
; CHECK-DAG: %[[r10:.+]] = icmp eq i8 %ld.transb, 78
; CHECK-DAG: %[[r11:.+]] = select i1 %[[r10]], i8 84, i8 %[[r9]]
; CHECK-DAG: %[[r12:.+]] = icmp eq i8 %ld.transb, 116
; CHECK-DAG: %[[r13:.+]] = select i1 %[[r12]], i8 110, i8 %[[r11]]
; CHECK-DAG: %[[r14:.+]] = icmp eq i8 %ld.transb, 84
; CHECK-DAG: %[[r15:.+]] = select i1 %[[r14]], i8 78, i8 %[[r13]]
; CHECK-NEXT: store i8 %[[r15]], i8* %byref.transpose.transb
; CHECK-NEXT: store i64 1, i64* %byref.int.one
; CHECK-NEXT: %intcast.int.one = bitcast i64* %byref.int.one to i8*
; CHECK-NEXT: %ld.row.trans = load i8, i8* %byref.transb, align 1
; CHECK-NEXT: %[[r55:.+]] = icmp eq i8 %ld.row.trans, 110
; CHECK-NEXT: %[[r56:.+]] = icmp eq i8 %ld.row.trans, 78
Expand Down
28 changes: 14 additions & 14 deletions enzyme/test/Enzyme/ReverseMode/blas/gemm_f_c_split.ll
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,10 @@ entry:
; CHECK: define internal void @diffef(i8* noalias %C, i8* %"C'", i8* noalias %A, i8* %"A'", i8* noalias %B, i8* %"B'", double*
; CHECK-NEXT: entry:
; CHECK-NEXT: %ret = alloca double
; CHECK-NEXT: %byref.transpose.transa = alloca i8
; CHECK-NEXT: %byref.transpose.transb = alloca i8
; CHECK-NEXT: %byref.int.one = alloca i64
; CHECK-NEXT: %byref.transpose.transb = alloca i8
; CHECK-NEXT: %byref.constant.fp.1.0 = alloca double
; CHECK-NEXT: %byref.transpose.transa = alloca i8
; CHECK-NEXT: %[[byref_fp_1_0:.+]] = alloca double
; CHECK-NEXT: %byref.constant.char.G = alloca i8
; CHECK-NEXT: %byref.constant.int.0 = alloca i64
Expand Down Expand Up @@ -212,16 +212,8 @@ entry:

; CHECK: invertentry: ; preds = %entry
; CHECK-NEXT: %[[r17:.+]] = bitcast double* %0 to i8*
; CHECK-NEXT: %ld.transa = load i8, i8* %malloccall
; CHECK-DAG: %[[r0:.+]] = icmp eq i8 %ld.transa, 110
; CHECK-DAG: %[[r1:.+]] = select i1 %[[r0]], i8 116, i8 0
; CHECK-DAG: %[[r2:.+]] = icmp eq i8 %ld.transa, 78
; CHECK-DAG: %[[r3:.+]] = select i1 %[[r2]], i8 84, i8 %[[r1]]
; CHECK-DAG: %[[r4:.+]] = icmp eq i8 %ld.transa, 116
; CHECK-DAG: %[[r5:.+]] = select i1 %[[r4]], i8 110, i8 %[[r3]]
; CHECK-DAG: %[[r6:.+]] = icmp eq i8 %ld.transa, 84
; CHECK-DAG: %[[r7:.+]] = select i1 %[[r6]], i8 78, i8 %[[r5]]
; CHECK-DAG: store i8 %[[r7]], i8* %byref.transpose.transa
; CHECK-NEXT: store i64 1, i64* %byref.int.one
; CHECK-NEXT: %intcast.int.one = bitcast i64* %byref.int.one to i8*
; CHECK-NEXT: %ld.transb = load i8, i8* %malloccall1
; CHECK-DAG: %[[r8:.+]] = icmp eq i8 %ld.transb, 110
; CHECK-DAG: %[[r9:.+]] = select i1 %[[r8]], i8 116, i8 0
Expand All @@ -232,8 +224,6 @@ entry:
; CHECK-DAG: %[[r14:.+]] = icmp eq i8 %ld.transb, 84
; CHECK-DAG: %[[r15:.+]] = select i1 %[[r14]], i8 78, i8 %[[r13]]
; CHECK-NEXT: store i8 %[[r15]], i8* %byref.transpose.transb
; CHECK-NEXT: store i64 1, i64* %byref.int.one
; CHECK-NEXT: %intcast.int.one = bitcast i64* %byref.int.one to i8*
; CHECK-NEXT: %ld.row.trans = load i8, i8* %malloccall, align 1
; CHECK-NEXT: %[[r34:.+]] = icmp eq i8 %ld.row.trans, 110
; CHECK-NEXT: %[[r35:.+]] = icmp eq i8 %ld.row.trans, 78
Expand All @@ -253,6 +243,16 @@ entry:
; CHECK-NEXT: store double 1.000000e+00, double* %byref.constant.fp.1.0, align 8
; CHECK-NEXT: %fpcast.constant.fp.1.0 = bitcast double* %byref.constant.fp.1.0 to i8*
; CHECK-NEXT: call void @dgemm_64_(i8* %[[r37]], i8* %[[r38]], i8* %[[r39]], i8* %[[r40]], i8* %n_p, i8* %alpha_p, i8* %[[r44]], i8* %[[r45]], i8* %[[r46]], i8* %[[r47]], i8* %fpcast.constant.fp.1.0, i8* %"A'", i8* %lda_p, i64 1, i64 1)
; CHECK-NEXT: %ld.transa = load i8, i8* %malloccall
; CHECK-DAG: %[[r0:.+]] = icmp eq i8 %ld.transa, 110
; CHECK-DAG: %[[r1:.+]] = select i1 %[[r0]], i8 116, i8 0
; CHECK-DAG: %[[r2:.+]] = icmp eq i8 %ld.transa, 78
; CHECK-DAG: %[[r3:.+]] = select i1 %[[r2]], i8 84, i8 %[[r1]]
; CHECK-DAG: %[[r4:.+]] = icmp eq i8 %ld.transa, 116
; CHECK-DAG: %[[r5:.+]] = select i1 %[[r4]], i8 110, i8 %[[r3]]
; CHECK-DAG: %[[r6:.+]] = icmp eq i8 %ld.transa, 84
; CHECK-DAG: %[[r7:.+]] = select i1 %[[r6]], i8 78, i8 %[[r5]]
; CHECK-DAG: store i8 %[[r7]], i8* %byref.transpose.transa
; CHECK-NEXT: %[[ld_row_trans4:.+]] = load i8, i8* %malloccall1, align 1
; CHECK-NEXT: %[[r48:.+]] = icmp eq i8 %[[ld_row_trans4]], 110
; CHECK-NEXT: %[[r49:.+]] = icmp eq i8 %[[ld_row_trans4]], 78
Expand Down
29 changes: 15 additions & 14 deletions enzyme/test/Enzyme/ReverseMode/blas/gemm_f_c_split_lacpy.ll
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,10 @@ entry:
; CHECK: define internal void @diffef(i8* noalias %C, i8* %"C'", i8* noalias %A, i8* %"A'", i8* noalias %B, i8* %"B'", double*
; CHECK-NEXT: entry:
; CHECK-NEXT: %ret = alloca double
; CHECK-NEXT: %byref.transpose.transa = alloca i8
; CHECK-NEXT: %byref.transpose.transb = alloca i8
; CHECK-NEXT: %byref.int.one = alloca i64
; CHECK-NEXT: %byref.transpose.transb = alloca i8
; CHECK-NEXT: %byref.constant.fp.1.0 = alloca double
; CHECK-NEXT: %byref.transpose.transa = alloca i8
; CHECK-NEXT: %[[fp107:.+]] = alloca double
; CHECK-NEXT: %byref.constant.char.G = alloca i8
; CHECK-NEXT: %byref.constant.int.0 = alloca i64
Expand Down Expand Up @@ -184,16 +184,8 @@ entry:

; CHECK: invertentry: ; preds = %entry
; CHECK-NEXT: %[[r17:.+]] = bitcast double* %0 to i8*
; CHECK-NEXT: %ld.transa = load i8, i8* %malloccall
; CHECK-DAG: %[[r0:.+]] = icmp eq i8 %ld.transa, 110
; CHECK-DAG: %[[r1:.+]] = select i1 %[[r0]], i8 116, i8 0
; CHECK-DAG: %[[r2:.+]] = icmp eq i8 %ld.transa, 78
; CHECK-DAG: %[[r3:.+]] = select i1 %[[r2]], i8 84, i8 %[[r1]]
; CHECK-DAG: %[[r4:.+]] = icmp eq i8 %ld.transa, 116
; CHECK-DAG: %[[r5:.+]] = select i1 %[[r4]], i8 110, i8 %[[r3]]
; CHECK-DAG: %[[r6:.+]] = icmp eq i8 %ld.transa, 84
; CHECK-DAG: %[[r7:.+]] = select i1 %[[r6]], i8 78, i8 %[[r5]]
; CHECK-DAG: store i8 %[[r7]], i8* %byref.transpose.transa
; CHECK-NEXT: store i64 1, i64* %byref.int.one
; CHECK-NEXT: %intcast.int.one = bitcast i64* %byref.int.one to i8*
; CHECK-NEXT: %ld.transb = load i8, i8* %malloccall1
; CHECK-DAG: %[[r8:.+]] = icmp eq i8 %ld.transb, 110
; CHECK-DAG: %[[r9:.+]] = select i1 %[[r8]], i8 116, i8 0
Expand All @@ -204,8 +196,6 @@ entry:
; CHECK-DAG: %[[r14:.+]] = icmp eq i8 %ld.transb, 84
; CHECK-DAG: %[[r15:.+]] = select i1 %[[r14]], i8 78, i8 %[[r13]]
; CHECK-NEXT: store i8 %[[r15]], i8* %byref.transpose.transb
; CHECK-NEXT: store i64 1, i64* %byref.int.one
; CHECK-NEXT: %intcast.int.one = bitcast i64* %byref.int.one to i8*
; CHECK-NEXT: %ld.row.trans = load i8, i8* %malloccall, align 1
; CHECK-NEXT: %[[r34:.+]] = icmp eq i8 %ld.row.trans, 110
; CHECK-NEXT: %[[r35:.+]] = icmp eq i8 %ld.row.trans, 78
Expand All @@ -226,6 +216,17 @@ entry:
; CHECK-NEXT: %fpcast.constant.fp.1.0 = bitcast double* %byref.constant.fp.1.0 to i8*
; CHECK-NEXT: call void @dgemm_64_(i8* %[[r37]], i8* %[[r38]], i8* %[[r39]], i8* %[[r40]], i8* %n_p, i8* %alpha_p, i8* %[[r44]], i8* %[[r45]], i8* %[[r46]], i8* %[[r47]], i8* %fpcast.constant.fp.1.0, i8* %"A'", i8* %lda_p, i64 1, i64 1)

; CHECK-NEXT: %ld.transa = load i8, i8* %malloccall
; CHECK-DAG: %[[r0:.+]] = icmp eq i8 %ld.transa, 110
; CHECK-DAG: %[[r1:.+]] = select i1 %[[r0]], i8 116, i8 0
; CHECK-DAG: %[[r2:.+]] = icmp eq i8 %ld.transa, 78
; CHECK-DAG: %[[r3:.+]] = select i1 %[[r2]], i8 84, i8 %[[r1]]
; CHECK-DAG: %[[r4:.+]] = icmp eq i8 %ld.transa, 116
; CHECK-DAG: %[[r5:.+]] = select i1 %[[r4]], i8 110, i8 %[[r3]]
; CHECK-DAG: %[[r6:.+]] = icmp eq i8 %ld.transa, 84
; CHECK-DAG: %[[r7:.+]] = select i1 %[[r6]], i8 78, i8 %[[r5]]
; CHECK-DAG: store i8 %[[r7]], i8* %byref.transpose.transa

; CHECK-NEXT: %[[trans4:.+]] = load i8, i8* %malloccall1, align 1
; CHECK-NEXT: %[[r48:.+]] = icmp eq i8 %[[trans4]], 110
; CHECK-NEXT: %[[r49:.+]] = icmp eq i8 %[[trans4]], 78
Expand Down
Loading
Loading