[llvm] r277161 - [GlobalISel] Fix LLT::unsized to match LLT(LabelTy).
Ahmed Bougacha via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 29 09:11:03 PDT 2016
Author: ab
Date: Fri Jul 29 11:11:02 2016
New Revision: 277161
URL: http://llvm.org/viewvc/llvm-project?rev=277161&view=rev
Log:
[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.
Modified:
llvm/trunk/include/llvm/CodeGen/LowLevelType.h
llvm/trunk/unittests/CodeGen/LowLevelTypeTest.cpp
Modified: llvm/trunk/include/llvm/CodeGen/LowLevelType.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/LowLevelType.h?rev=277161&r1=277160&r2=277161&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/LowLevelType.h (original)
+++ llvm/trunk/include/llvm/CodeGen/LowLevelType.h Fri Jul 29 11:11:02 2016
@@ -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)
Modified: llvm/trunk/unittests/CodeGen/LowLevelTypeTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/CodeGen/LowLevelTypeTest.cpp?rev=277161&r1=277160&r2=277161&view=diff
==============================================================================
--- llvm/trunk/unittests/CodeGen/LowLevelTypeTest.cpp (original)
+++ llvm/trunk/unittests/CodeGen/LowLevelTypeTest.cpp Fri Jul 29 11:11:02 2016
@@ -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));
}
}
More information about the llvm-commits
mailing list