[llvm] [SandboxIR] Add missing VectorType functions (PR #107650)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 9 12:53:39 PDT 2024
================
@@ -268,16 +268,50 @@ define void @foo({i32, i8} %v0) {
TEST_F(SandboxTypeTest, VectorType) {
parseIR(C, R"IR(
-define void @foo(<2 x i8> %v0) {
+define void @foo(<4 x i16> %vi0, <4 x float> %vf1, i8 %i0) {
ret void
}
)IR");
llvm::Function *LLVMF = &*M->getFunction("foo");
sandboxir::Context Ctx(C);
auto *F = Ctx.createFunction(LLVMF);
- // Check classof(), creation.
- [[maybe_unused]] auto *VecTy =
- cast<sandboxir::VectorType>(F->getArg(0)->getType());
+ // Check classof(), creation, accessors
+ auto *VecTy = cast<sandboxir::VectorType>(F->getArg(0)->getType());
+ EXPECT_TRUE(VecTy->getElementType()->isIntegerTy(16));
+ EXPECT_EQ(VecTy->getElementCount(), ElementCount::getFixed(4));
+
+ auto *FVecTy = cast<sandboxir::VectorType>(F->getArg(1)->getType());
----------------
vporpo wrote:
I think we are not testing the new `get()` functions:
```
// get(ElementType, NumElements, Scalable)
EXPECT_EQ(VectorType::get(Type::getInt16Ty(Ctx), 4, **/*Scalable=*/false), F>getArg(0)->getType());
// get(ElementType, Other)
EXPECT_EQ(VectorType::get(Type::getInt16Ty(Ctx), F->getArg(0)->getType()), F->getArg(0)->getType());
```
https://github.com/llvm/llvm-project/pull/107650
More information about the llvm-commits
mailing list