tolerate llvm.eh.selector.i64 on 32-bit systems and llvm.eh.selector.i32 on

64-bit systems.

llvm-svn: 82180
This commit is contained in:
Chris Lattner 2009-09-17 23:54:54 +00:00
parent bf2fd768f9
commit 1bd81314e7
1 changed files with 24 additions and 21 deletions

View File

@ -4000,9 +4000,7 @@ SelectionDAGLowering::visitIntrinsicCall(CallInst &I, unsigned Intrinsic) {
case Intrinsic::eh_selector_i32:
case Intrinsic::eh_selector_i64: {
MachineModuleInfo *MMI = DAG.getMachineModuleInfo();
EVT VT = (Intrinsic == Intrinsic::eh_selector_i32 ? MVT::i32 : MVT::i64);
if (MMI) {
if (CurMBB->isLandingPad())
AddCatchInfo(I, MMI, CurMBB);
else {
@ -4015,17 +4013,22 @@ SelectionDAGLowering::visitIntrinsicCall(CallInst &I, unsigned Intrinsic) {
}
// Insert the EHSELECTION instruction.
SDVTList VTs = DAG.getVTList(VT, MVT::Other);
SDVTList VTs = DAG.getVTList(TLI.getPointerTy(), MVT::Other);
SDValue Ops[2];
Ops[0] = getValue(I.getOperand(1));
Ops[1] = getRoot();
SDValue Op = DAG.getNode(ISD::EHSELECTION, dl, VTs, Ops, 2);
setValue(&I, Op);
DAG.setRoot(Op.getValue(1));
} else {
setValue(&I, DAG.getConstant(0, VT));
}
DAG.setRoot(Op.getValue(1));
MVT::SimpleValueType VT =
(Intrinsic == Intrinsic::eh_selector_i32 ? MVT::i32 : MVT::i64);
if (Op.getValueType().getSimpleVT() < VT)
Op = DAG.getNode(ISD::ZERO_EXTEND, dl, VT, Op);
else if (Op.getValueType().getSimpleVT() < VT)
Op = DAG.getNode(ISD::TRUNCATE, dl, VT, Op);
setValue(&I, Op);
return 0;
}