[PATCH] D24327: [DAGCombine] Modification of visitBR_CC

bryant via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 8 06:03:47 PDT 2016


bryant added inline comments.

================
Comment at: lib/CodeGen/SelectionDAG/DAGCombiner.cpp:9673
@@ +9672,3 @@
+    // -->
+    // br_cc cond %1, 0
+    SDNode *CondLHSNode = CondLHS.getNode();
----------------
could this be generalized further? i.e., `(br_cc cc, (add X, c0), c1, bb) => (br_cc cc, X, (c1 - c0), bb)`, assuming that `c1 >= c0`. and then generalize that to other binary ops?

================
Comment at: lib/CodeGen/SelectionDAG/DAGCombiner.cpp:9687
@@ +9686,3 @@
+          AddRHS.getValueType().getScalarType().getSizeInBits() ==
+              CondRHS.getValueType().getScalarType().getSizeInBits() &&
+          APInt::isSameValue(ConstAddRHS->getAPIntValue(),
----------------
`EVT::getScalarSizeInBits`. also, isn't it already the case that `VT(AddRHS) == VT(AddLHS) == VT(CondLHSNode)` (because of the implied constraint on add operands) and `VT(CondLHSNode) == VT(CondRHS)` (because of br_cc's constraint)?

================
Comment at: lib/CodeGen/SelectionDAG/DAGCombiner.cpp:9695
@@ +9694,3 @@
+                     << "\n");
+        DEBUG(dbgs() << "ConstNRHS - ConstAddRHS: "
+                     << ConstNRHS->getAPIntValue() -
----------------
not so sure that this is the appropriate place for debug output.

================
Comment at: test/CodeGen/AArch64/DAGCombine-optimize-brcc.ll:46
@@ +45,2 @@
+  ret i64 %conv3.sink
+}
----------------
could this test case be simplified?


https://reviews.llvm.org/D24327





More information about the llvm-commits mailing list