[flang] Fix folding of CMPLX
authorpeter klausler <pklausler@nvidia.com>
Wed, 2 Jun 2021 23:59:31 +0000 (16:59 -0700)
committerpeter klausler <pklausler@nvidia.com>
Thu, 3 Jun 2021 20:11:31 +0000 (13:11 -0700)
commit6fa5353a5696bf8c4c2689126a025330c72aa8f9
treefd6c9ac02d572ad0ed67bc766f27ed40ef347013
parent53ab2d821ed5bf282a733e87e8f53511c55e5ea2
[flang] Fix folding of CMPLX

The code for folding calls to the intrinsic function CMPLX was
incorrectly dependent on the number of arguments to distinguish its
two cases (conversion from one kind of complex to another, and
composition of a complex value from real & imaginary parts).
This was wrong since the optional KIND= argument has already been
taken into account by intrinsic processing; instead, the type of
the first argument should decide the issue.

Differential Revision: https://reviews.llvm.org/D103568
flang/lib/Evaluate/fold-complex.cpp