Combining DIV+REM->DIVREM doesn't belong in LegalizeDAG; move it over into DAGCombiner.
authorArtyom Skrobov <Artyom.Skrobov@arm.com>
Tue, 20 Oct 2015 13:06:02 +0000 (13:06 +0000)
committerArtyom Skrobov <Artyom.Skrobov@arm.com>
Tue, 20 Oct 2015 13:06:02 +0000 (13:06 +0000)
commit42c2a81d51d83ca296f9cea5852e8c1f26081a6a
tree03a2a1b1db37f47f4fc8f91c596f3b91d51d2cc3
parent7bbbc5ccde67f669db7863a3930bfef3b04ae106
Combining DIV+REM->DIVREM doesn't belong in LegalizeDAG; move it over into DAGCombiner.

Summary:
In addition to moving the code over, this patch amends the DIV,REM -> DIVREM
combining to run on all affected nodes at once: if the nodes are converted
to DIVREM one at a time, then the resulting DIVREM may get legalized by the
backend into something target-specific that we won't be able to recognize
and correlate with the remaining nodes.

The motivation is to "prepare terrain" for D13862: when we set DIV and REM
to be legalized to libcalls, instead of the DIVREM, we otherwise lose the
ability to combine them together. To prevent this, we need to take the
DIV,REM -> DIVREM combining out of the lowering stage.

Reviewers: RKSimon, eli.friedman, rengolin

Subscribers: john.brawn, rengolin, llvm-commits

Differential Revision: http://reviews.llvm.org/D13733

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250825 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/SelectionDAG/DAGCombiner.cpp
lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
lib/CodeGen/SelectionDAG/LegalizeVectorOps.cpp