[llvm] [RISCV][GlobalISel] Legalize G_ADD, G_SUB, G_AND, G_OR, G_XOR on RISC-V Vector Extension (PR #71400)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 20 15:41:18 PST 2023


topperc wrote:

Maybe 

```
      .legalIf(all(typeInSet(0, AllVecTys), [=, &ST](const LegalityQuery &Query) {
        return ST.hasVInstructions() &&
               (Query.Types[0].getScalarSizeInBits() != 64 ||
                ST.hasVInstructionsI64()) &&
               (Query.Types[0].getElementCount().getKnownMinValue() != 1 ||
                ST.getELen() == 64);
      })
```

typeInSet will copy the initialize_list to a SmallVector before creating a lambda. I think by calling it as part of `all` that lambda will get created before the initializer list goes out of scope.

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


More information about the llvm-commits mailing list