aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Target/PowerPC/PPCISelLowering.cpp
diff options
context:
space:
mode:
authorBill Schmidt <wschmidt@linux.vnet.ibm.com>2013-07-09 18:50:20 +0000
committerBill Schmidt <wschmidt@linux.vnet.ibm.com>2013-07-09 18:50:20 +0000
commit7c2d8f7b5ea1d0abaed1176f87ea2509e65e82be (patch)
tree115281e3513a0a5ac93015ecd61dd04629136d23 /lib/Target/PowerPC/PPCISelLowering.cpp
parent36f6df78add32371df38266f02c2197a608f83ae (diff)
downloadexternal_llvm-7c2d8f7b5ea1d0abaed1176f87ea2509e65e82be.zip
external_llvm-7c2d8f7b5ea1d0abaed1176f87ea2509e65e82be.tar.gz
external_llvm-7c2d8f7b5ea1d0abaed1176f87ea2509e65e82be.tar.bz2
[PowerPC] Better fix for PR16556.
A more complete example of the bug in PR16556 was recently provided, showing that the previous fix was not sufficient. The previous fix is reverted herein. The real problem is that ReplaceNodeResults() uses LowerFP_TO_INT as custom lowering for FP_TO_SINT during type legalization, without checking whether the input type is handled by that routine. LowerFP_TO_INT requires the input to be f32 or f64, so we fail when the input is ppcf128. I'm leaving the test case from the initial fix (r185821) in place, and adding the new test as another crash-only check. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185959 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/PowerPC/PPCISelLowering.cpp')
-rw-r--r--lib/Target/PowerPC/PPCISelLowering.cpp12
1 files changed, 3 insertions, 9 deletions
diff --git a/lib/Target/PowerPC/PPCISelLowering.cpp b/lib/Target/PowerPC/PPCISelLowering.cpp
index 812f096..791d334 100644
--- a/lib/Target/PowerPC/PPCISelLowering.cpp
+++ b/lib/Target/PowerPC/PPCISelLowering.cpp
@@ -4720,15 +4720,6 @@ SDValue PPCTargetLowering::LowerFP_TO_INT(SDValue Op, SelectionDAG &DAG,
SDLoc dl) const {
assert(Op.getOperand(0).getValueType().isFloatingPoint());
SDValue Src = Op.getOperand(0);
-
- // If we have a long double here, it must be that we have an undef of
- // that type. In this case return an undef of the target type.
- if (Src.getValueType() == MVT::ppcf128) {
- assert(Src.getOpcode() == ISD::UNDEF && "Unhandled ppcf128!");
- return DAG.getNode(ISD::UNDEF, dl,
- Op.getValueType().getSimpleVT().SimpleTy);
- }
-
if (Src.getValueType() == MVT::f32)
Src = DAG.getNode(ISD::FP_EXTEND, dl, MVT::f64, Src);
@@ -5808,6 +5799,9 @@ void PPCTargetLowering::ReplaceNodeResults(SDNode *N,
return;
}
case ISD::FP_TO_SINT:
+ // LowerFP_TO_INT() can only handle f32 and f64.
+ if (N->getOperand(0).getValueType() == MVT::ppcf128)
+ return;
Results.push_back(LowerFP_TO_INT(SDValue(N, 0), DAG, dl));
return;
}