[llvm-commits] Patch for add/sub expansion without addc in LegalizeDAG.cpp
Evan Cheng
evan.cheng at apple.com
Fri Dec 12 09:53:36 PST 2008
On Dec 9, 2008, at 1:27 PM, Daniel M Gessel wrote:
> We're not yet using Legalize Types in our project, and, with help from
> Mon Ping, I found what looks like a bug in the add/sub expansion in
> LegalizeDAG.cpp that's still in the SVN repository. Mon Ping checked
> how it's done in LegalizeIntegerTypes.cpp and this updates
> LegalizeDAG.cpp to reflect that.
>
> IIUC, this code will soon be fully deprecated but I thought I'd post
> the patch anyway.
Thanks. The patch is generally correct but
SDVTList VTList = DAG.getVTList(LHSL.getValueType(), MVT::Flag);
should be moved into
if(hasCarry) {
}
Do you have commit privilege?
Thanks,
Evan
>
>
> Dan
>
>
>
> Index: lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
> ===================================================================
> --- lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (revision 60773)
> +++ lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (working copy)
> @@ -6865,8 +6865,8 @@
> break;
> } else {
> if (Node->getOpcode() == ISD::ADD) {
> - Lo = DAG.getNode(ISD::ADD, VTList, LoOps, 2);
> - Hi = DAG.getNode(ISD::ADD, VTList, HiOps, 2);
> + Lo = DAG.getNode(ISD::ADD, NVT, LoOps, 2);
> + Hi = DAG.getNode(ISD::ADD, NVT, HiOps, 2);
> SDValue Cmp1 = DAG.getSetCC(TLI.getSetCCResultType(Lo),
> Lo, LoOps[0], ISD::SETULT);
> SDValue Carry1 = DAG.getNode(ISD::SELECT, NVT, Cmp1,
> @@ -6879,8 +6879,8 @@
> Carry1);
> Hi = DAG.getNode(ISD::ADD, NVT, Hi, Carry2);
> } else {
> - Lo = DAG.getNode(ISD::SUB, VTList, LoOps, 2);
> - Hi = DAG.getNode(ISD::SUB, VTList, HiOps, 2);
> + Lo = DAG.getNode(ISD::SUB, NVT, LoOps, 2);
> + Hi = DAG.getNode(ISD::SUB, NVT, HiOps, 2);
> SDValue Cmp = DAG.getSetCC(NVT, LoOps[0], LoOps[1],
> ISD::SETULT);
> SDValue Borrow = DAG.getNode(ISD::SELECT, NVT, Cmp,
> DAG.getConstant(1, NVT),
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list