Skip to content

Commit 542ae6f

Browse files
Add more tests
1 parent 3462527 commit 542ae6f

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1979,7 +1979,6 @@ Value *LibCallSimplifier::optimizeCAbs(CallInst *CI, IRBuilderBase &B) {
19791979
if (ConstReal->isZeroValue()) {
19801980
IRBuilderBase::FastMathFlagGuard Guard(B);
19811981
B.setFastMathFlags(CI->getFastMathFlags());
1982-
19831982
return copyFlags(
19841983
*CI, B.CreateUnaryIntrinsic(Intrinsic::fabs, Imag, nullptr, "cabs"));
19851984
}

llvm/test/Transforms/InstCombine/cabs-discrete.ll

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,12 @@ define double @fast_cabs_zero_real(double %imag) {
4949
ret double %call
5050
}
5151

52-
define double @fast_cabs_zero_real(double %real) {
53-
; CHECK-LABEL: @fast_cabs_zero_real(
52+
define double @fast_cabs_zero_imag(double %real) {
53+
; CHECK-LABEL: @fast_cabs_zero_imag(
5454
; CHECK-NEXT: [[CABS:%.*]] = tail call double @llvm.fabs.f64(double [[REAL:%.*]])
5555
; CHECK-NEXT: ret double [[CABS]]
5656
;
57-
%call = tail call double @cabs(double %real, 0.0)
57+
%call = tail call double @cabs(double %real, double 0.0)
5858
ret double %call
5959
}
6060

@@ -79,12 +79,12 @@ define float @fast_cabsf_zero_real(float %imag) {
7979
ret float %call
8080
}
8181

82-
define float @fast_cabsf_zero_real(float %real) {
83-
; CHECK-LABEL: @fast_cabsf_zero_real(
82+
define float @fast_cabsf_zero_imag(float %real) {
83+
; CHECK-LABEL: @fast_cabsf_zero_imag(
8484
; CHECK-NEXT: [[CABS:%.*]] = tail call float @llvm.fabs.f64(float [[REAL:%.*]])
8585
; CHECK-NEXT: ret float [[CABS]]
8686
;
87-
%call = tail call float @cabsf(float %real, 0.0)
87+
%call = tail call float @cabsf(float %real, float 0.0)
8888
ret float %call
8989
}
9090

@@ -109,12 +109,12 @@ define fp128 @fast_cabsl_zero_real(fp128 %imag) {
109109
ret fp128 %call
110110
}
111111

112-
define fp128 @fast_cabsl_zero_real(fp128 %real) {
113-
; CHECK-LABEL: @fast_cabsl_zero_real(
112+
define fp128 @fast_cabsl_zero_imag(fp128 %real) {
113+
; CHECK-LABEL: @fast_cabsl_zero_imag(
114114
; CHECK-NEXT: [[CABS:%.*]] = tail call fp128 @llvm.fabs.f128(fp128 [[REAL:%.*]])
115115
; CHECK-NEXT: ret fp128 [[CABS]]
116116
;
117-
%call = tail call fp128 @cabsl(fp128 %real, 0.0)
117+
%call = tail call fp128 @cabsl(fp128 %real, fp128 0.0)
118118
ret fp128 %call
119119
}
120120

0 commit comments

Comments
 (0)