[PATCH] D42948: [SelectionDAG] Support some SimplifySetCC cases for comparing against vector splats of constants.

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 6 17:25:43 PST 2018


spatel added inline comments.


================
Comment at: lib/CodeGen/SelectionDAG/TargetLowering.cpp:1891
       if (C1 == MinVal)
-        return DAG.getConstant(1, dl, VT);
-
-      // X >= C0 --> X > (C0 - 1)
-      APInt C = C1 - 1;
-      ISD::CondCode NewCC = (Cond == ISD::SETGE) ? ISD::SETGT : ISD::SETUGT;
-      if ((DCI.isBeforeLegalizeOps() ||
-           isCondCodeLegal(NewCC, VT.getSimpleVT())) &&
-          (!N1C->isOpaque() || (N1C->isOpaque() && C.getBitWidth() <= 64 &&
-                                isLegalICmpImmediate(C.getSExtValue())))) {
-        return DAG.getSetCC(dl, VT, N0,
-                            DAG.getConstant(C, dl, N1.getValueType()),
-                            NewCC);
+        return DAG.getBooleanTrueConstant(dl, VT);
+
----------------
spatel wrote:
> craig.topper wrote:
> > spatel wrote:
> > > Is this (and similar diffs below) currently wrong for ZeroOrNegativeOneBooleanContent targets?
> > > I'm having a hard time seeing all the pre-conditions in this 900 line monster of a function...
> > I suspect it is. I believe there are other lines in here that I didn't touch that are probably also wrong.
> > 
> > I can split out the getBooleanTrueConstant function and fix this up for scalar types first if you want?
> If it's not too hard, that would be good. A quick check of in-tree targets says AMDGPU, NVPTX, and some flavors of MIPS could hit that bug via scalar ZeroOrNegativeOneBooleanContent.
Oops - I read that wrong. Looks like all MIPS have ZeroOrOneBooleanContent for scalars.


Repository:
  rL LLVM

https://reviews.llvm.org/D42948





More information about the llvm-commits mailing list