[llvm] [VPlan] Constant-fold ActiveLaneMask intrinsics (PR #208852)

David Sherwood via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 3 01:57:42 PDT 2026


================
@@ -4466,9 +4466,12 @@ static Constant *ConstantFoldFixedVectorCall(
 
     for (unsigned I = 0; I < NumElements; ++I) {
       ConstantInt *Elt0 =
-          cast<ConstantInt>(Operands[0]->getAggregateElement(I));
+          dyn_cast<ConstantInt>(Operands[0]->getAggregateElement(I));
----------------
david-arm wrote:

How was it exposed? The only thing I can think of is the extra code you've added in `ConstantFoldIntrinsic`:

```
 if (auto *FVTy = dyn_cast<FixedVectorType>(Ty))
    return ConstantFoldFixedVectorCall("", ID, FVTy, Ops, DL);
```

but again that code change isn't specifically tied to the active-lane-mask intrinsic. What I mean is, if you completely remove the vplan changes in this PR do you still see the bug? I just thought you might be able to land an initial PR with refactoring plus web-assembly fix, followed by the vplan changes.

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


More information about the llvm-commits mailing list