Skip to content

Commit 0cebae8

Browse files
committed
Remove constant optimisation.
1 parent dce85c3 commit 0cebae8

File tree

3 files changed

+3
-29
lines changed

3 files changed

+3
-29
lines changed

flang/lib/Optimizer/Builder/IntrinsicCall.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1280,14 +1280,6 @@ mlir::Value genComplexPow(fir::FirOpBuilder &builder, mlir::Location loc,
12801280
const MathOperation &mathOp,
12811281
mlir::FunctionType mathLibFuncType,
12821282
llvm::ArrayRef<mlir::Value> args) {
1283-
if (auto expInt = fir::getIntIfConstant(args[1]))
1284-
if (*expInt >= 2 && *expInt <= 8) {
1285-
mlir::Value result = args[0];
1286-
for (int i = 1; i < *expInt; ++i)
1287-
result = builder.create<mlir::complex::MulOp>(loc, result, args[0]);
1288-
return builder.createConvert(loc, mathLibFuncType.getResult(0), result);
1289-
}
1290-
12911283
bool canUseApprox = mlir::arith::bitEnumContainsAny(
12921284
builder.getFastMathFlags(), mlir::arith::FastMathFlags::afn);
12931285
bool isAMDGPU = fir::getTargetTriple(builder.getModule()).isAMDGCN();

flang/test/Lower/amdgcn-complex.f90

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,10 @@ subroutine cexpf_test(a, b)
1818
b = exp(a)
1919
end subroutine
2020

21-
! CHECK-LABEL: func @_QPpow_test1(
22-
! CHECK: complex.mul
23-
! CHECK-NOT: complex.pow
24-
! CHECK-NOT: fir.call @_FortranAcpowi
25-
subroutine pow_test1(a, b)
26-
complex :: a, b
27-
a = b**2
28-
end subroutine pow_test1
29-
30-
! CHECK-LABEL: func @_QPpow_test2(
21+
! CHECK-LABEL: func @_QPpow_test(
3122
! CHECK: complex.pow
3223
! CHECK-NOT: fir.call @_FortranAcpowi
33-
subroutine pow_test2(a, b, c)
24+
subroutine pow_test(a, b, c)
3425
complex :: a, b, c
3526
a = b**c
36-
end subroutine pow_test2
27+
end subroutine pow_test

flang/test/Lower/power-operator.f90

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -142,12 +142,3 @@ subroutine pow_c8_c8(x, y, z)
142142
! FAST: complex.pow %{{.*}}, %{{.*}} : complex<f64>
143143
! PRECISE: call @cpow
144144
end subroutine
145-
146-
! CHECK-LABEL: pow_const
147-
subroutine pow_const(a, b)
148-
complex :: a, b
149-
! CHECK-NOT: complex.pow
150-
! CHECK-NOT: @_FortranAcpowi
151-
! CHECK-COUNT-3: complex.mul
152-
a = b**4
153-
end subroutine

0 commit comments

Comments
 (0)