[PATCH] D56283: [X86] Add INSERT_SUBVECTOR to ComputeNumSignBits

Simon Pilgrim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 3 13:36:32 PST 2019


RKSimon added inline comments.


================
Comment at: lib/CodeGen/SelectionDAG/SelectionDAG.cpp:3719
+    SDValue Sub = Op.getOperand(1);
+    ConstantSDNode *SubIdx = dyn_cast<ConstantSDNode>(Op.getOperand(2));
+    unsigned NumSubElts = Sub.getValueType().getVectorNumElements();
----------------
auto *SubIdx


================
Comment at: lib/CodeGen/SelectionDAG/SelectionDAG.cpp:3722
+    if (SubIdx && SubIdx->getAPIntValue().ule(NumElts - NumSubElts)) {
+      Tmp = Op.getValueSizeInBits();
+      uint64_t Idx = SubIdx->getZExtValue();
----------------
Use same approach as CONCAT_VECTORS above:
```
Tmp = std::numeric_limits<unsigned>::max();
...
assert(Tmp <= VTBits && "Failed to determine minimum sign bits");
```


================
Comment at: lib/CodeGen/SelectionDAG/SelectionDAG.cpp:3739
+      if (Tmp == 1) return 1; // early-out
+      Tmp2 = ComputeNumSignBits(Src, Depth + 1);
+      Tmp = std::min(Tmp, Tmp2);
----------------
Is it safe to use DemandedElts at least on Src?


================
Comment at: lib/CodeGen/SelectionDAG/SelectionDAG.cpp:3743
+    }
+  }
+  }
----------------
Add a break - even though its the last case in the switch


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56283/new/

https://reviews.llvm.org/D56283





More information about the llvm-commits mailing list