Merge commit 64b31d96d from llvm git (by Nemanja Ivanovic):

[PowerPC] Do not attempt to reuse load for 64-bit FP_TO_UINT without
  FPCVT

  We call the function that attempts to reuse the conversion without
  checking whether the target matches the constraints that the callee
  expects. This patch adds the check prior to the call.

  Fixes: https://bugs.llvm.org/show_bug.cgi?id=43976

  Differential revision: https://reviews.llvm.org/D77564

This should fix 'Assertion failed: ((Op.getOpcode() == ISD::FP_TO_SINT
|| Subtarget.hasFPCVT()) && "i64 FP_TO_UINT is supported only with
FPCVT"), function LowerFP_TO_INTForReuse, file
/usr/src/contrib/llvm/lib/Target/PowerPC/PPCISelLowering.cpp, line 7276'
when building the devel/libslang2 port (and a few others) for PowerPC64.

Requested by:	pkubaj
MFC after:	6 weeks
X-MFC-With:	358851
This commit is contained in:
Dimitry Andric 2020-04-20 19:16:10 +00:00
parent e38977381f
commit 5c94a87341
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=360134

View File

@ -7848,9 +7848,10 @@ bool PPCTargetLowering::canReuseLoadAddress(SDValue Op, EVT MemVT,
SelectionDAG &DAG,
ISD::LoadExtType ET) const {
SDLoc dl(Op);
bool ValidFPToUint = Op.getOpcode() == ISD::FP_TO_UINT &&
(Subtarget.hasFPCVT() || Op.getValueType() == MVT::i32);
if (ET == ISD::NON_EXTLOAD &&
(Op.getOpcode() == ISD::FP_TO_UINT ||
Op.getOpcode() == ISD::FP_TO_SINT) &&
(ValidFPToUint || Op.getOpcode() == ISD::FP_TO_SINT) &&
isOperationLegalOrCustom(Op.getOpcode(),
Op.getOperand(0).getValueType())) {