[PATCH] D22247: [DAGCombine] Make sext(setcc) combine respect getBooleanContents()
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 11 16:58:53 PDT 2016
arsenm added a subscriber: arsenm.
================
Comment at: lib/CodeGen/SelectionDAG/DAGCombiner.cpp:6208
@@ -6205,1 +6207,3 @@
unsigned ElementWidth = VT.getScalarType().getSizeInBits();
+ unsigned SetCCWidth = N0.getValueType().getScalarType().getSizeInBits();
+
----------------
getScalarSizeInBits
================
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);
----------------
TLI should have a getConstantTrue(VT) helper (I thought I added this a long time ago but I don't see it)
http://reviews.llvm.org/D22247
More information about the llvm-commits
mailing list