[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:
parent
9f986bf3a9
commit
8292bdf735
|
@ -77,7 +77,7 @@ public:
|
||||||
/// \brief get an unsized but valid low-level type (e.g. for a label).
|
/// \brief get an unsized but valid low-level type (e.g. for a label).
|
||||||
|
|
||||||
static LLT unsized() {
|
static LLT unsized() {
|
||||||
return LLT{Unsized, 1, 0};
|
return LLT{Unsized, 0, 0};
|
||||||
}
|
}
|
||||||
|
|
||||||
explicit LLT(TypeKind Kind, uint16_t NumElements, unsigned SizeOrAddrSpace)
|
explicit LLT(TypeKind Kind, uint16_t NumElements, unsigned SizeOrAddrSpace)
|
||||||
|
|
|
@ -187,6 +187,8 @@ TEST(LowLevelTypeTest, Invalid) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(LowLevelTypeTest, Unsized) {
|
TEST(LowLevelTypeTest, Unsized) {
|
||||||
|
LLVMContext C;
|
||||||
|
|
||||||
const LLT Ty = LLT::unsized();
|
const LLT Ty = LLT::unsized();
|
||||||
|
|
||||||
ASSERT_TRUE(Ty.isValid());
|
ASSERT_TRUE(Ty.isValid());
|
||||||
|
@ -194,5 +196,8 @@ TEST(LowLevelTypeTest, Unsized) {
|
||||||
ASSERT_FALSE(Ty.isSized());
|
ASSERT_FALSE(Ty.isSized());
|
||||||
ASSERT_FALSE(Ty.isPointer());
|
ASSERT_FALSE(Ty.isPointer());
|
||||||
ASSERT_FALSE(Ty.isVector());
|
ASSERT_FALSE(Ty.isVector());
|
||||||
|
|
||||||
|
const Type *IRTy = Type::getLabelTy(C);
|
||||||
|
EXPECT_EQ(Ty, LLT(*IRTy));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue