[llvm] [ValueTracking] Support non-constant idx for `computeKnownFPClass` of `insertelement` (PR #87708)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Sat Apr 6 12:45:37 PDT 2024


================
@@ -5355,14 +5355,17 @@ void computeKnownFPClass(const Value *V, const APInt &DemandedElts,
     const Value *Vec = Op->getOperand(0);
     const Value *Elt = Op->getOperand(1);
     auto *CIdx = dyn_cast<ConstantInt>(Op->getOperand(2));
-    // Early out if the index is non-constant or out-of-range.
     unsigned NumElts = DemandedElts.getBitWidth();
-    if (!CIdx || CIdx->getValue().uge(NumElts))
-      return;
+    APInt DemandedVecElts = DemandedElts;
+    bool NeedsElt = true;
+    // If we know the index we are inserting too, clear it from Vec check.
----------------
arsenm wrote:

```suggestion
    // If we know the index we are inserting to, clear it from Vec check.
```

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


More information about the llvm-commits mailing list