[PATCH] D15034: TargetLowering: Improve handling of (setcc ([sz]ext x) 0, cc) in SimplifySetCC

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 13 10:06:23 PST 2016


arsenm added inline comments.

================
Comment at: lib/CodeGen/SelectionDAG/TargetLowering.cpp:1394-1396
@@ +1393,5 @@
+                                    N0Opc == ISD::SIGN_EXTEND)) ||
+            (isConstTrueVal(N1C) &&
+             ((N1C->isOne() && N0Opc == ISD::ZERO_EXTEND) ||
+             (N1C->isAllOnesValue() && N0Opc == ISD::SIGN_EXTEND))))) {
+
----------------
I didn't expect to still have the isOne/isAllOnesValue. I didn't realize that you would still need to check the compare type in addition to making sure the true value matched the extend type. In that case it might be be clearer to check the boolean content along with the value.

In either case this is a lot of parentheses so splitting these into a helper isExtendedTrueVal or something like that would help.


http://reviews.llvm.org/D15034





More information about the llvm-commits mailing list