[llvm] [ValueTracking][X86] Compute KnownBits for phadd/phsub (PR #92429)

via llvm-commits llvm-commits at lists.llvm.org
Sun May 19 09:47:37 PDT 2024


================
@@ -950,6 +950,41 @@ getKnownBitsFromAndXorOr(const Operator *I, const APInt &DemandedElts,
   return KnownOut;
 }
 
+static KnownBits computeKnownBitsForHorizontalOperation(
+    const Operator *I, const APInt &DemandedElts, unsigned Depth,
+    const SimplifyQuery &Q,
+    const std::function<KnownBits(const KnownBits &, const KnownBits &)>
+        KnownBitsFunc) {
+  APInt DemandedEltsLHS, DemandedEltsRHS;
+  getHorizontalDemandedElts(DemandedElts, DemandedEltsLHS, DemandedEltsRHS);
+
+  std::array<KnownBits, 2> KnownLHS;
+  for (unsigned Index = 0; Index < KnownLHS.size(); ++Index) {
+    if (!DemandedEltsLHS.isZero()) {
----------------
goldsteinn wrote:

I think you must never be hitting this case otherwise think we will run into issues with uninitialized used of `KnownLHS`. Likewise below for RHS.

https://github.com/llvm/llvm-project/pull/92429


More information about the llvm-commits mailing list