diff options
author | John Brawn <john.brawn@arm.com> | 2020-02-13 14:52:33 +0000 |
---|---|---|
committer | Hans Wennborg <hans@chromium.org> | 2020-02-18 16:46:43 +0100 |
commit | cbac41966b8f9356a3e69c050b60770108550d1e (patch) | |
tree | 5a42e0e882cfde1610118439ad745b13ca3d77f2 /llvm/lib/Target/ARM/ARMISelLowering.cpp | |
parent | cff417cffd61d2c4607eb142e272ec10ebec2c21 (diff) | |
download | bcm5719-llvm-cbac41966b8f9356a3e69c050b60770108550d1e.tar.gz bcm5719-llvm-cbac41966b8f9356a3e69c050b60770108550d1e.zip |
[ARM] Fix infinite loop when lowering STRICT_FP_EXTEND
If the target has FP64 but not FP16 then we have custom lowering for FP_EXTEND
and STRICT_FP_EXTEND with type f64. However if the extend is from f32 to f64 the
current implementation will cause in infinite loop for STRICT_FP_EXTEND due to
emitting a merge_values of the original node which after replacement becomes a
merge_values of itself.
Fix this by not doing anything for f32 to f64 extend when we have FP64, though
for STRICT_FP_EXTEND we have to do the strict-to-nonstrict mutation as that
doesn't happen automatically for opcodes with custom lowering.
Differential Revision: https://reviews.llvm.org/D74559
(cherry picked from commit 0ec57972967dfb43fc022c2e3788be041d1db730)
Diffstat (limited to 'llvm/lib/Target/ARM/ARMISelLowering.cpp')
-rw-r--r-- | llvm/lib/Target/ARM/ARMISelLowering.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/llvm/lib/Target/ARM/ARMISelLowering.cpp b/llvm/lib/Target/ARM/ARMISelLowering.cpp index 8e4bb91d53b..559a4e8435c 100644 --- a/llvm/lib/Target/ARM/ARMISelLowering.cpp +++ b/llvm/lib/Target/ARM/ARMISelLowering.cpp @@ -16380,6 +16380,15 @@ SDValue ARMTargetLowering::LowerFP_EXTEND(SDValue Op, SelectionDAG &DAG) const { assert(!(DstSz == 32 && Subtarget->hasFP16()) && "With FP16, 16 to 32 conversion is legal!"); + // Converting from 32 -> 64 is valid if we have FP64. + if (SrcSz == 32 && DstSz == 64 && Subtarget->hasFP64()) { + // FIXME: Remove this when we have strict fp instruction selection patterns + if (IsStrict) { + DAG.mutateStrictFPToFP(Op.getNode()); + } + return Op; + } + // Either we are converting from 16 -> 64, without FP16 and/or // FP.double-precision or without Armv8-fp. So we must do it in two // steps. |