[PATCH] DAGCombiner: Continue combining if FoldConstantArithmetic() fails.
Matthias Braun
matze at braunis.de
Tue Jan 13 09:14:32 PST 2015
> On Jan 12, 2015, at 8:02 PM, Ahmed Bougacha <ahmed.bougacha at gmail.com> wrote:
>
> ================
> Comment at: lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1572
> @@ +1571,3 @@
> + if (N0C && N1C) {
> + SDValue Folded = DAG.FoldConstantArithmetic(ISD::ADD, VT, N0C, N1C);
> + if (Folded.getNode())
> ----------------
> How about:
>
> if (SDValue Folded = ...)
> return Folded;
>
> Or going further, you could remove the N0C && N1C check, since FoldConstantArithmetic also does it (a sliver more wasteful though).
unfortunately
if ((SDValue Folded = ...).getNode())
return Folded;
would be necessary and is not valid C++.
More information about the llvm-commits
mailing list