[PATCH] D22247: [DAGCombine] Make sext(setcc) combine respect getBooleanContents()

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 11 17:20:28 PDT 2016


arsenm added inline comments.

================
Comment at: lib/CodeGen/SelectionDAG/DAGCombiner.cpp:6211-6215
@@ -6206,3 +6210,7 @@
     SDLoc DL(N);
-    SDValue NegOne =
-      DAG.getConstant(APInt::getAllOnesValue(ElementWidth), DL, VT);
+    APInt TrueInt =
+        ((SetCCWidth != 1) && (TLI.getBooleanContents(VT) ==
+                               TargetLowering::ZeroOrOneBooleanContent))
+            ? APInt(ElementWidth, 1)
+            : APInt::getAllOnesValue(ElementWidth);
+    SDValue TrueVal = DAG.getConstant(TrueInt, DL, VT);
----------------
mkuper wrote:
> arsenm wrote:
> > TLI should have a getConstantTrue(VT) helper (I thought I added this a long time ago but I don't see it)
> I couldn't find one either. We have an isConstTrueVal(), but not a getConstTrueVal() (I think).
> Do you think this is generally useful? If so, I can factor it out into TLI.
Yes, there are plenty of places that have broken BooleanContent handling for targets that use -1, so more helpers would be useful


http://reviews.llvm.org/D22247





More information about the llvm-commits mailing list