[llvm] [VPlan] Improve code around canConstantBeExtended (NFC) (PR #161652)

David Sherwood via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 16 02:19:56 PDT 2025


================
@@ -7954,9 +7954,9 @@ bool VPRecipeBuilder::getScaledReductions(
   auto CollectExtInfo = [this, &Exts, &ExtOpTypes,
                          &ExtKinds](SmallVectorImpl<Value *> &Ops) -> bool {
     for (const auto &[I, OpI] : enumerate(Ops)) {
-      auto *CI = dyn_cast<ConstantInt>(OpI);
-      if (I > 0 && CI &&
-          canConstantBeExtended(CI, ExtOpTypes[0], ExtKinds[0])) {
+      const APInt *C;
----------------
david-arm wrote:

I guess if all you care about is passing a APInt to `canConstantBeExtended` you could equally achieve the same with the original code:

```
      auto *CI = dyn_cast<ConstantInt>(OpI);
      if (I > 0 && CI &&
          canConstantBeExtended(CI->getValue(), ExtOpTypes[0], ExtKinds[0])) {
```

but I'm happy either way.

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


More information about the llvm-commits mailing list