-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[SandboxIR] Add missing VectorType functions #107650
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
llvm/include/llvm/SandboxIR/Type.h
Outdated
inline ElementCount getElementCount() const { | ||
return cast<llvm::VectorType>(LLVMTy)->getElementCount(); | ||
} | ||
static VectorType *getInteger(Context &Ctx, VectorType *VTy); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need the Ctx
argument, you can get it like: VTy->getContext()
. Same for the rest of the functions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
EXPECT_TRUE(IVecTy->getElementType()->isIntegerTy(32)); | ||
EXPECT_EQ(IVecTy->getElementCount(), FVecTy->getElementCount()); | ||
|
||
auto *ExtVecTy = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: I usually add a comment mentioning the function being tested. This makes the test a bit more readable, especially in cases where you a check spans multiple lines of code. In this case something like // getExtendedVectorType
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
llvm/include/llvm/SandboxIR/Type.h
Outdated
return VectorType::get(ElementType, | ||
ElementCount::get(NumElements, Scalable)); | ||
} | ||
// Needs tests |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm which tests are missing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Delete stale comment
EXPECT_TRUE(VecTy->getElementType()->isIntegerTy(16)); | ||
EXPECT_EQ(VecTy->getElementCount(), ElementCount::getFixed(4)); | ||
|
||
auto *FVecTy = cast<sandboxir::VectorType>(F->getArg(1)->getType()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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());
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
Fills in many missing functions from VectorType