Skip to content

Commit

Permalink
[InstCombine] avoid 'tmp' usage in test files; NFC
Browse files Browse the repository at this point in the history
The update script ( utils/update_test_checks.py ) warns against this.
  • Loading branch information
rotateright committed May 26, 2021
1 parent b70fe92 commit 9e43b1e
Show file tree
Hide file tree
Showing 2 changed files with 84 additions and 84 deletions.
84 changes: 42 additions & 42 deletions llvm/test/Transforms/InstCombine/fmul-exp.ll
Original file line number Diff line number Diff line change
Expand Up @@ -7,79 +7,79 @@ declare void @use(double)
; exp(a) * exp(b) no reassoc flags
define double @exp_a_exp_b(double %a, double %b) {
; CHECK-LABEL: @exp_a_exp_b(
; CHECK-NEXT: [[TMP:%.*]] = call double @llvm.exp.f64(double [[A:%.*]])
; CHECK-NEXT: [[TMP1:%.*]] = call double @llvm.exp.f64(double [[B:%.*]])
; CHECK-NEXT: [[MUL:%.*]] = fmul double [[TMP]], [[TMP1]]
; CHECK-NEXT: [[T:%.*]] = call double @llvm.exp.f64(double [[A:%.*]])
; CHECK-NEXT: [[T1:%.*]] = call double @llvm.exp.f64(double [[B:%.*]])
; CHECK-NEXT: [[MUL:%.*]] = fmul double [[T]], [[T1]]
; CHECK-NEXT: ret double [[MUL]]
;
%tmp = call double @llvm.exp.f64(double %a)
%tmp1 = call double @llvm.exp.f64(double %b)
%mul = fmul double %tmp, %tmp1
%t = call double @llvm.exp.f64(double %a)
%t1 = call double @llvm.exp.f64(double %b)
%mul = fmul double %t, %t1
ret double %mul
}

; exp(a) * exp(b) reassoc, multiple uses
define double @exp_a_exp_b_multiple_uses(double %a, double %b) {
; CHECK-LABEL: @exp_a_exp_b_multiple_uses(
; CHECK-NEXT: [[TMP1:%.*]] = call double @llvm.exp.f64(double [[B:%.*]])
; CHECK-NEXT: [[TMP:%.*]] = fadd reassoc double [[A:%.*]], [[B]]
; CHECK-NEXT: [[TMP2:%.*]] = call reassoc double @llvm.exp.f64(double [[TMP]])
; CHECK-NEXT: call void @use(double [[TMP1]])
; CHECK-NEXT: [[T1:%.*]] = call double @llvm.exp.f64(double [[B:%.*]])
; CHECK-NEXT: [[TMP1:%.*]] = fadd reassoc double [[A:%.*]], [[B]]
; CHECK-NEXT: [[TMP2:%.*]] = call reassoc double @llvm.exp.f64(double [[TMP1]])
; CHECK-NEXT: call void @use(double [[T1]])
; CHECK-NEXT: ret double [[TMP2]]
;
%tmp = call double @llvm.exp.f64(double %a)
%tmp1 = call double @llvm.exp.f64(double %b)
%mul = fmul reassoc double %tmp, %tmp1
call void @use(double %tmp1)
%t = call double @llvm.exp.f64(double %a)
%t1 = call double @llvm.exp.f64(double %b)
%mul = fmul reassoc double %t, %t1
call void @use(double %t1)
ret double %mul
}

; exp(a) * exp(b) reassoc, both with multiple uses
define double @exp_a_exp_b_multiple_uses_both(double %a, double %b) {
; CHECK-LABEL: @exp_a_exp_b_multiple_uses_both(
; CHECK-NEXT: [[TMP:%.*]] = call double @llvm.exp.f64(double [[A:%.*]])
; CHECK-NEXT: [[TMP1:%.*]] = call double @llvm.exp.f64(double [[B:%.*]])
; CHECK-NEXT: [[MUL:%.*]] = fmul reassoc double [[TMP]], [[TMP1]]
; CHECK-NEXT: call void @use(double [[TMP]])
; CHECK-NEXT: call void @use(double [[TMP1]])
; CHECK-NEXT: [[T:%.*]] = call double @llvm.exp.f64(double [[A:%.*]])
; CHECK-NEXT: [[T1:%.*]] = call double @llvm.exp.f64(double [[B:%.*]])
; CHECK-NEXT: [[MUL:%.*]] = fmul reassoc double [[T]], [[T1]]
; CHECK-NEXT: call void @use(double [[T]])
; CHECK-NEXT: call void @use(double [[T1]])
; CHECK-NEXT: ret double [[MUL]]
;
%tmp = call double @llvm.exp.f64(double %a)
%tmp1 = call double @llvm.exp.f64(double %b)
%mul = fmul reassoc double %tmp, %tmp1
call void @use(double %tmp)
call void @use(double %tmp1)
%t = call double @llvm.exp.f64(double %a)
%t1 = call double @llvm.exp.f64(double %b)
%mul = fmul reassoc double %t, %t1
call void @use(double %t)
call void @use(double %t1)
ret double %mul
}

; exp(a) * exp(b) => exp(a+b) with reassoc
define double @exp_a_exp_b_reassoc(double %a, double %b) {
; CHECK-LABEL: @exp_a_exp_b_reassoc(
; CHECK-NEXT: [[TMP:%.*]] = fadd reassoc double [[A:%.*]], [[B:%.*]]
; CHECK-NEXT: [[TMP1:%.*]] = call reassoc double @llvm.exp.f64(double [[TMP]])
; CHECK-NEXT: ret double [[TMP1]]
; CHECK-NEXT: [[TMP1:%.*]] = fadd reassoc double [[A:%.*]], [[B:%.*]]
; CHECK-NEXT: [[TMP2:%.*]] = call reassoc double @llvm.exp.f64(double [[TMP1]])
; CHECK-NEXT: ret double [[TMP2]]
;
%tmp = call double @llvm.exp.f64(double %a)
%tmp1 = call double @llvm.exp.f64(double %b)
%mul = fmul reassoc double %tmp, %tmp1
%t = call double @llvm.exp.f64(double %a)
%t1 = call double @llvm.exp.f64(double %b)
%mul = fmul reassoc double %t, %t1
ret double %mul
}

; exp(a) * exp(b) * exp(c) * exp(d) => exp(a+b+c+d) with reassoc
define double @exp_a_exp_b_exp_c_exp_d_fast(double %a, double %b, double %c, double %d) {
; CHECK-LABEL: @exp_a_exp_b_exp_c_exp_d_fast(
; CHECK-NEXT: [[TMP:%.*]] = fadd reassoc double [[A:%.*]], [[B:%.*]]
; CHECK-NEXT: [[TMP1:%.*]] = fadd reassoc double [[TMP]], [[C:%.*]]
; CHECK-NEXT: [[TMP2:%.*]] = fadd reassoc double [[TMP1]], [[D:%.*]]
; CHECK-NEXT: [[TMP3:%.*]] = call reassoc double @llvm.exp.f64(double [[TMP2]])
; CHECK-NEXT: ret double [[TMP3]]
; CHECK-NEXT: [[TMP1:%.*]] = fadd reassoc double [[A:%.*]], [[B:%.*]]
; CHECK-NEXT: [[TMP2:%.*]] = fadd reassoc double [[TMP1]], [[C:%.*]]
; CHECK-NEXT: [[TMP3:%.*]] = fadd reassoc double [[TMP2]], [[D:%.*]]
; CHECK-NEXT: [[TMP4:%.*]] = call reassoc double @llvm.exp.f64(double [[TMP3]])
; CHECK-NEXT: ret double [[TMP4]]
;
%tmp = call double @llvm.exp.f64(double %a)
%tmp1 = call double @llvm.exp.f64(double %b)
%mul = fmul reassoc double %tmp, %tmp1
%tmp2 = call double @llvm.exp.f64(double %c)
%mul1 = fmul reassoc double %mul, %tmp2
%tmp3 = call double @llvm.exp.f64(double %d)
%mul2 = fmul reassoc double %mul1, %tmp3
%t = call double @llvm.exp.f64(double %a)
%t1 = call double @llvm.exp.f64(double %b)
%mul = fmul reassoc double %t, %t1
%t2 = call double @llvm.exp.f64(double %c)
%mul1 = fmul reassoc double %mul, %t2
%t3 = call double @llvm.exp.f64(double %d)
%mul2 = fmul reassoc double %mul1, %t3
ret double %mul2
}
84 changes: 42 additions & 42 deletions llvm/test/Transforms/InstCombine/fmul-exp2.ll
Original file line number Diff line number Diff line change
Expand Up @@ -7,79 +7,79 @@ declare void @use(double)
; exp2(a) * exp2(b) no reassoc flags
define double @exp2_a_exp2_b(double %a, double %b) {
; CHECK-LABEL: @exp2_a_exp2_b(
; CHECK-NEXT: [[TMP:%.*]] = call double @llvm.exp2.f64(double [[A:%.*]])
; CHECK-NEXT: [[TMP1:%.*]] = call double @llvm.exp2.f64(double [[B:%.*]])
; CHECK-NEXT: [[MUL:%.*]] = fmul double [[TMP]], [[TMP1]]
; CHECK-NEXT: [[T:%.*]] = call double @llvm.exp2.f64(double [[A:%.*]])
; CHECK-NEXT: [[T1:%.*]] = call double @llvm.exp2.f64(double [[B:%.*]])
; CHECK-NEXT: [[MUL:%.*]] = fmul double [[T]], [[T1]]
; CHECK-NEXT: ret double [[MUL]]
;
%tmp = call double @llvm.exp2.f64(double %a)
%tmp1 = call double @llvm.exp2.f64(double %b)
%mul = fmul double %tmp, %tmp1
%t = call double @llvm.exp2.f64(double %a)
%t1 = call double @llvm.exp2.f64(double %b)
%mul = fmul double %t, %t1
ret double %mul
}

; exp2(a) * exp2(b) reassoc, multiple uses
define double @exp2_a_exp2_b_multiple_uses(double %a, double %b) {
; CHECK-LABEL: @exp2_a_exp2_b_multiple_uses(
; CHECK-NEXT: [[TMP1:%.*]] = call double @llvm.exp2.f64(double [[B:%.*]])
; CHECK-NEXT: [[TMP:%.*]] = fadd reassoc double [[A:%.*]], [[B]]
; CHECK-NEXT: [[TMP2:%.*]] = call reassoc double @llvm.exp2.f64(double [[TMP]])
; CHECK-NEXT: call void @use(double [[TMP1]])
; CHECK-NEXT: [[T1:%.*]] = call double @llvm.exp2.f64(double [[B:%.*]])
; CHECK-NEXT: [[TMP1:%.*]] = fadd reassoc double [[A:%.*]], [[B]]
; CHECK-NEXT: [[TMP2:%.*]] = call reassoc double @llvm.exp2.f64(double [[TMP1]])
; CHECK-NEXT: call void @use(double [[T1]])
; CHECK-NEXT: ret double [[TMP2]]
;
%tmp = call double @llvm.exp2.f64(double %a)
%tmp1 = call double @llvm.exp2.f64(double %b)
%mul = fmul reassoc double %tmp, %tmp1
call void @use(double %tmp1)
%t = call double @llvm.exp2.f64(double %a)
%t1 = call double @llvm.exp2.f64(double %b)
%mul = fmul reassoc double %t, %t1
call void @use(double %t1)
ret double %mul
}

; exp2(a) * exp2(b) reassoc, both with multiple uses
define double @exp2_a_exp2_b_multiple_uses_both(double %a, double %b) {
; CHECK-LABEL: @exp2_a_exp2_b_multiple_uses_both(
; CHECK-NEXT: [[TMP:%.*]] = call double @llvm.exp2.f64(double [[A:%.*]])
; CHECK-NEXT: [[TMP1:%.*]] = call double @llvm.exp2.f64(double [[B:%.*]])
; CHECK-NEXT: [[MUL:%.*]] = fmul reassoc double [[TMP]], [[TMP1]]
; CHECK-NEXT: call void @use(double [[TMP]])
; CHECK-NEXT: call void @use(double [[TMP1]])
; CHECK-NEXT: [[T:%.*]] = call double @llvm.exp2.f64(double [[A:%.*]])
; CHECK-NEXT: [[T1:%.*]] = call double @llvm.exp2.f64(double [[B:%.*]])
; CHECK-NEXT: [[MUL:%.*]] = fmul reassoc double [[T]], [[T1]]
; CHECK-NEXT: call void @use(double [[T]])
; CHECK-NEXT: call void @use(double [[T1]])
; CHECK-NEXT: ret double [[MUL]]
;
%tmp = call double @llvm.exp2.f64(double %a)
%tmp1 = call double @llvm.exp2.f64(double %b)
%mul = fmul reassoc double %tmp, %tmp1
call void @use(double %tmp)
call void @use(double %tmp1)
%t = call double @llvm.exp2.f64(double %a)
%t1 = call double @llvm.exp2.f64(double %b)
%mul = fmul reassoc double %t, %t1
call void @use(double %t)
call void @use(double %t1)
ret double %mul
}

; exp2(a) * exp2(b) => exp2(a+b) with reassoc
define double @exp2_a_exp2_b_reassoc(double %a, double %b) {
; CHECK-LABEL: @exp2_a_exp2_b_reassoc(
; CHECK-NEXT: [[TMP:%.*]] = fadd reassoc double [[A:%.*]], [[B:%.*]]
; CHECK-NEXT: [[TMP1:%.*]] = call reassoc double @llvm.exp2.f64(double [[TMP]])
; CHECK-NEXT: ret double [[TMP1]]
; CHECK-NEXT: [[TMP1:%.*]] = fadd reassoc double [[A:%.*]], [[B:%.*]]
; CHECK-NEXT: [[TMP2:%.*]] = call reassoc double @llvm.exp2.f64(double [[TMP1]])
; CHECK-NEXT: ret double [[TMP2]]
;
%tmp = call double @llvm.exp2.f64(double %a)
%tmp1 = call double @llvm.exp2.f64(double %b)
%mul = fmul reassoc double %tmp, %tmp1
%t = call double @llvm.exp2.f64(double %a)
%t1 = call double @llvm.exp2.f64(double %b)
%mul = fmul reassoc double %t, %t1
ret double %mul
}

; exp2(a) * exp2(b) * exp2(c) * exp2(d) => exp2(a+b+c+d) with reassoc
define double @exp2_a_exp2_b_exp2_c_exp2_d(double %a, double %b, double %c, double %d) {
; CHECK-LABEL: @exp2_a_exp2_b_exp2_c_exp2_d(
; CHECK-NEXT: [[TMP:%.*]] = fadd reassoc double [[A:%.*]], [[B:%.*]]
; CHECK-NEXT: [[TMP1:%.*]] = fadd reassoc double [[TMP]], [[C:%.*]]
; CHECK-NEXT: [[TMP2:%.*]] = fadd reassoc double [[TMP1]], [[D:%.*]]
; CHECK-NEXT: [[TMP3:%.*]] = call reassoc double @llvm.exp2.f64(double [[TMP2]])
; CHECK-NEXT: ret double [[TMP3]]
; CHECK-NEXT: [[TMP1:%.*]] = fadd reassoc double [[A:%.*]], [[B:%.*]]
; CHECK-NEXT: [[TMP2:%.*]] = fadd reassoc double [[TMP1]], [[C:%.*]]
; CHECK-NEXT: [[TMP3:%.*]] = fadd reassoc double [[TMP2]], [[D:%.*]]
; CHECK-NEXT: [[TMP4:%.*]] = call reassoc double @llvm.exp2.f64(double [[TMP3]])
; CHECK-NEXT: ret double [[TMP4]]
;
%tmp = call double @llvm.exp2.f64(double %a)
%tmp1 = call double @llvm.exp2.f64(double %b)
%mul = fmul reassoc double %tmp, %tmp1
%tmp2 = call double @llvm.exp2.f64(double %c)
%mul1 = fmul reassoc double %mul, %tmp2
%tmp3 = call double @llvm.exp2.f64(double %d)
%mul2 = fmul reassoc double %mul1, %tmp3
%t = call double @llvm.exp2.f64(double %a)
%t1 = call double @llvm.exp2.f64(double %b)
%mul = fmul reassoc double %t, %t1
%t2 = call double @llvm.exp2.f64(double %c)
%mul1 = fmul reassoc double %mul, %t2
%t3 = call double @llvm.exp2.f64(double %d)
%mul2 = fmul reassoc double %mul1, %t3
ret double %mul2
}

0 comments on commit 9e43b1e

Please sign in to comment.