[PATCH] D25221: [PPC][DAGCombine] Convert SETCC to subtract when the result is zero extended

Kit Barton via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 24 11:09:36 PDT 2016


kbarton requested changes to this revision.
kbarton added inline comments.
This revision now requires changes to proceed.


================
Comment at: lib/Target/PowerPC/PPCISelLowering.cpp:9891
 
+static SDValue GenerateEquivalentSub(SDNode *N, int size, bool complement,
+                                     bool swap, SDLoc &dl, SelectionDAG &DAG) {
----------------
nemanjai wrote:
> I'm not sure why the variable names are lowercase here.
Need comments here about the logic and what the assumptions are in terms of input parameters, etc. 


================
Comment at: lib/Target/PowerPC/PPCISelLowering.cpp:9928
+
+  ISD::CondCode CC = cast<CondCodeSDNode>(N->getOperand(2))->get();;
+  auto OpSize = N->getOperand(0).getNode()->getValueType(0).getSizeInBits();
----------------
nemanjai wrote:
> I think an assert should be added somewhere in this function as well to make sure you have the right node type or else this may trip an assert in a location that will make it difficult to debug.
Some guidelines on the types of casts that can be used are here: http://llvm.org/docs/ProgrammersManual.html#the-isa-cast-and-dyn-cast-templates

It's probably good to pick one, and then either put the appropriate checks earlier, or make sure to add comments stating it is assumed this is only called with nodes of a specific type. 


https://reviews.llvm.org/D25221





More information about the llvm-commits mailing list