[GlobalISel] Fix LLT::unsized to match LLT(LabelTy).

When coming from an IR label type, we set a 0 NumElements, but not
when constructing an LLT using unsized(), causing comparisons to fail.

Pick one variant and fix the other.

llvm-svn: 277161
This commit is contained in:
Ahmed Bougacha 2016-07-29 16:11:02 +00:00
parent 9f986bf3a9
commit 8292bdf735
2 changed files with 6 additions and 1 deletions

View File

@ -77,7 +77,7 @@ public:
/// \brief get an unsized but valid low-level type (e.g. for a label).
static LLT unsized() {
return LLT{Unsized, 1, 0};
return LLT{Unsized, 0, 0};
}
explicit LLT(TypeKind Kind, uint16_t NumElements, unsigned SizeOrAddrSpace)

View File

@ -187,6 +187,8 @@ TEST(LowLevelTypeTest, Invalid) {
}
TEST(LowLevelTypeTest, Unsized) {
LLVMContext C;
const LLT Ty = LLT::unsized();
ASSERT_TRUE(Ty.isValid());
@ -194,5 +196,8 @@ TEST(LowLevelTypeTest, Unsized) {
ASSERT_FALSE(Ty.isSized());
ASSERT_FALSE(Ty.isPointer());
ASSERT_FALSE(Ty.isVector());
const Type *IRTy = Type::getLabelTy(C);
EXPECT_EQ(Ty, LLT(*IRTy));
}
}