[PATCH] D29528: [DAGCombiner] Push truncate through adde when the carry isn't used.

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Feb 4 10:22:02 PST 2017


arsenm added inline comments.


================
Comment at: lib/CodeGen/SelectionDAG/DAGCombiner.cpp:7874
+      !N0.getNode()->hasAnyUseOfValue(1) &&
+      TLI.isOperationLegalOrCustom(ISD::ADDE, VT)) {
+    auto SL = SDLoc(N);
----------------
Usually this is done as !LegalizeDAG || TLI.isOperationLegal..


================
Comment at: lib/CodeGen/SelectionDAG/DAGCombiner.cpp:7875
+      TLI.isOperationLegalOrCustom(ISD::ADDE, VT)) {
+    auto SL = SDLoc(N);
+    auto C1 = DAG.getNode(ISD::TRUNCATE, SL, VT, N0.getOperand(0));
----------------
SDLoc SL(N)


================
Comment at: test/CodeGen/X86/adde-carry.ll:109-110
 ; CHECK-NEXT:    movq %rdx, 8(%rdi)
+; CHECK-NEXT:    sbbl %eax, %eax
+; CHECK-NEXT:    andl $1, %eax
 ; CHECK-NEXT:    addl %eax, 16(%rdi)
----------------
Can you add tests with more types?


https://reviews.llvm.org/D29528





More information about the llvm-commits mailing list