[PATCH] D32756: [DAGCombine] Refactor common addcarry pattern.

Amaury SECHET via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 5 10:11:34 PDT 2017


deadalnix added inline comments.


================
Comment at: lib/CodeGen/SelectionDAG/DAGCombiner.cpp:2175
+   *                  /           \
+   * (addcarry 0, 0, *)  (addcarry *, 0, Z)
+   *                 \        /
----------------
deadalnix wrote:
> spatel wrote:
> > I like the ascii art!
> > 
> > I'm still not very familiar with the carry ops, so I would've kept the formulas from the previous rev in here too. This is complicated enough that I think it's justified to have both.
> > 
> > But I have a question about this node: (addcarry 0, 0, *)
> > Can that be simplified to a cast instruction from bool to the VT of the addcarry?
> > If yes, if we add that simplification, will it break this pattern matching?
> I think you are correct. Let me do a patch with (addcarry 0, 0, X) to (extend/trunc X) and see where this goes.
So i played a bit with it, and as it turns out, it makes some things worse, other better. I still think this is useful, we just need to add a few patterns to get things back to normal after the fact, like promoting uaddo into addcarry when one of the parameter actually comes from a carry.


https://reviews.llvm.org/D32756





More information about the llvm-commits mailing list