[llvm] r352291 - [X86] combineAddOrSubToADCOrSBB/combineCarryThroughADD - use oneuse for entire SDNode

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Sat Jan 26 13:29:17 PST 2019


Author: rksimon
Date: Sat Jan 26 13:29:16 2019
New Revision: 352291

URL: http://llvm.org/viewvc/llvm-project?rev=352291&view=rev
Log:
[X86] combineAddOrSubToADCOrSBB/combineCarryThroughADD - use oneuse for entire SDNode

Fix issue noted in D57281 that only tested the one use for the SDValue (the result flag), not the entire SUB.

I've added the getNode() to make it clearer what is intended than just the -> redirection.

Modified:
    llvm/trunk/lib/Target/X86/X86ISelLowering.cpp

Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=352291&r1=352290&r2=352291&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Sat Jan 26 13:29:16 2019
@@ -34901,7 +34901,8 @@ static SDValue combineCarryThroughADD(SD
           // Do not flip "e > c", where "c" is a constant, because Cmp
           // instruction cannot take an immediate as its first operand.
           //
-          if (CarryOp1.getOpcode() == X86ISD::SUB && CarryOp1.hasOneUse() &&
+          if (CarryOp1.getOpcode() == X86ISD::SUB &&
+              CarryOp1.getNode()->hasOneUse() &&
               CarryOp1.getValueType().isInteger() &&
               !isa<ConstantSDNode>(CarryOp1.getOperand(1))) {
             SDValue SubCommute =
@@ -40716,7 +40717,7 @@ static SDValue combineAddOrSubToADCOrSBB
     // Do not flip "e > c", where "c" is a constant, because Cmp instruction
     // cannot take an immediate as its first operand.
     //
-    if (EFLAGS.getOpcode() == X86ISD::SUB && EFLAGS.hasOneUse() &&
+    if (EFLAGS.getOpcode() == X86ISD::SUB && EFLAGS.getNode()->hasOneUse() &&
         EFLAGS.getValueType().isInteger() &&
         !isa<ConstantSDNode>(EFLAGS.getOperand(1))) {
       SDValue NewSub = DAG.getNode(X86ISD::SUB, SDLoc(EFLAGS),




More information about the llvm-commits mailing list