diff options
author | Shiva Chen <shiva0217@gmail.com> | 2019-09-01 04:52:54 +0000 |
---|---|---|
committer | Shiva Chen <shiva0217@gmail.com> | 2019-09-01 04:52:54 +0000 |
commit | adfdcb9c2652aeee585b9005fd6c67be06af8ea9 (patch) | |
tree | b495f2360640085ea5e9f2c07135729b7e280621 /llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp | |
parent | ede9a5293defbefe36acc7a4863de69678738751 (diff) | |
download | bcm5719-llvm-adfdcb9c2652aeee585b9005fd6c67be06af8ea9.tar.gz bcm5719-llvm-adfdcb9c2652aeee585b9005fd6c67be06af8ea9.zip |
[TargetLowering] Fix Bugzilla ID 43183 to avoid soften comparison broken with constant inputs
Summary:
This fixes the bugzilla id 43183 which triggerd by the following commit:
[RISCV] Avoid generating AssertZext for LP64 ABI when lowering floating LibCall
llvm-svn: 370604
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp index 35ca9fa4f2f..f83526be4a8 100644 --- a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp @@ -127,7 +127,6 @@ TargetLowering::makeLibCall(SelectionDAG &DAG, RTLIB::Libcall LC, EVT RetVT, Args.reserve(Ops.size()); TargetLowering::ArgListEntry Entry; - SDNode *N = CallOptions.NodeBeforeSoften; for (unsigned i = 0; i < Ops.size(); ++i) { SDValue NewOp = Ops[i]; Entry.Node = NewOp; @@ -136,8 +135,8 @@ TargetLowering::makeLibCall(SelectionDAG &DAG, RTLIB::Libcall LC, EVT RetVT, CallOptions.IsSExt); Entry.IsZExt = !Entry.IsSExt; - SDValue OldOp = N ? N->getOperand(i) : NewOp; - if (!shouldExtendTypeInLibCall(OldOp.getValueType())) { + if (CallOptions.IsSoften && + !shouldExtendTypeInLibCall(CallOptions.OpsVTBeforeSoften[i])) { Entry.IsSExt = Entry.IsZExt = false; } Args.push_back(Entry); @@ -153,8 +152,8 @@ TargetLowering::makeLibCall(SelectionDAG &DAG, RTLIB::Libcall LC, EVT RetVT, bool signExtend = shouldSignExtendTypeInLibCall(RetVT, CallOptions.IsSExt); bool zeroExtend = !signExtend; - RetVT = N ? N->getValueType(0) : RetVT; - if (!shouldExtendTypeInLibCall(RetVT)) { + if (CallOptions.IsSoften && + !shouldExtendTypeInLibCall(CallOptions.RetVTBeforeSoften)) { signExtend = zeroExtend = false; } @@ -379,12 +378,10 @@ void TargetLowering::softenSetCCOperands(SelectionDAG &DAG, EVT VT, // Use the target specific return value for comparions lib calls. EVT RetVT = getCmpLibcallReturnType(); SDValue Ops[2] = {NewLHS, NewRHS}; - SDValue OldSETCC = DAG.getNode( - ISD::SETCC, dl, - getSetCCResultType(DAG.getDataLayout(), *DAG.getContext(), RetVT), - OldLHS, OldRHS, DAG.getCondCode(CCCode)); TargetLowering::MakeLibCallOptions CallOptions; - CallOptions.setNodeBeforeSoften(OldSETCC.getNode()); + EVT OpsVT[2] = { OldLHS.getValueType(), + OldRHS.getValueType() }; + CallOptions.setTypeListBeforeSoften(OpsVT, RetVT, true); NewLHS = makeLibCall(DAG, LC1, RetVT, Ops, CallOptions, dl).first; NewRHS = DAG.getConstant(0, dl, RetVT); |