Fix GDB printers test

- Prevent symbols from being stripped so that it can run with 'RelWithDebInfo'.
- Adjust llvm-support CHECKs after code changes.
- Polish mlir-support CHECKs as suggested in https://reviews.llvm.org/D116646.

Differential Revision: https://reviews.llvm.org/D116837
This commit is contained in:
Christian Sigg 2022-01-07 22:44:41 +01:00
parent 3e9919cf57
commit fb4869e26c
4 changed files with 71 additions and 57 deletions

View File

@ -61,12 +61,15 @@ auto SimpleIlist = []() {
}();
int main() {
// Reference symbols that might otherwise be stripped.
ArrayRef[0];
MutableArrayRef[0];
(void)!ExpectedValue;
(void)!ExpectedError;
*OptionalValue;
*OptionalNone;
return 0;
std::uintptr_t result = 0;
auto dont_strip = [&](const auto &val) {
result += reinterpret_cast<std::uintptr_t>(&val);
};
dont_strip(ArrayRef);
dont_strip(MutableArrayRef);
dont_strip(ExpectedValue);
dont_strip(ExpectedError);
dont_strip(OptionalValue);
dont_strip(OptionalNone);
return result; // Non-zero return value is OK.
}

View File

@ -64,7 +64,7 @@ set print pretty
# CHECK: },
# CHECK: <llvm::ilist_node<IlistNode, llvm::ilist_tag<B> >> = {
# CHECK: prev = [[Node_14]],
# CHECK: next = [[SimpleIlist_Sentinel:0x.*]] <SimpleIlist>
# CHECK: next = [[SimpleIlist_Sentinel:0x.*]] <completed>
# CHECK: },
# CHECK: members of IlistNode:
# CHECK: Value = 13
@ -87,7 +87,7 @@ set print pretty
# CHECK: next = [[Ilist_Sentinel]] <Ilist>
# CHECK: },
# CHECK: <llvm::ilist_node<IlistNode, llvm::ilist_tag<B> >> = {
# CHECK: prev = [[SimpleIlist_Sentinel]] <SimpleIlist>,
# CHECK: prev = [[SimpleIlist_Sentinel]] <completed>,
# CHECK: next = [[Node_14]]
# CHECK: },
# CHECK: members of IlistNode:
@ -103,7 +103,7 @@ p Ilist
# CHECK: next = [[Ilist_Sentinel]] <Ilist>
# CHECK: },
# CHECK: <llvm::ilist_node<IlistNode, llvm::ilist_tag<B> >> = {
# CHECK: prev = [[SimpleIlist_Sentinel]] <SimpleIlist>,
# CHECK: prev = [[SimpleIlist_Sentinel]] <completed>,
# CHECK: next = [[Node_14]]
# CHECK: },
# CHECK: members of IlistNode:
@ -128,7 +128,7 @@ p Ilist
# CHECK: },
# CHECK: <llvm::ilist_node<IlistNode, llvm::ilist_tag<B> >> = {
# CHECK: prev = [[Node_14]],
# CHECK: next = [[SimpleIlist_Sentinel]] <SimpleIlist>
# CHECK: next = [[SimpleIlist_Sentinel]] <completed>
# CHECK: },
# CHECK: members of IlistNode:
# CHECK: Value = 13

View File

@ -41,4 +41,12 @@ mlir::Attribute StringAttr = mlir::StringAttr::get(&Context, "foo");
mlir::Attribute ElementsAttr = mlir::DenseElementsAttr::get(
VectorType.cast<mlir::ShapedType>(), llvm::ArrayRef<float>{2.0f, 3.0f});
int main() { return 0; }
int main() {
// Reference symbols that might otherwise be stripped.
std::uintptr_t result = 0;
auto dont_strip = [&](const auto &val) {
result += reinterpret_cast<std::uintptr_t>(&val);
};
dont_strip(Value);
return result; // Non-zero return value is OK.
}

View File

@ -24,121 +24,124 @@ print Type
# CHECK-LABEL: +print IndexType
print IndexType
# CHECK: mlir::IndexType
# CHECK: typeID = mlir::TypeID::get<mlir::IndexType>()
# CHECK-LABEL: +print IntegerType
print IntegerType
# CHECK: mlir::IntegerType
# CHECK: width = 3
# CHECK: Unsigned
# CHECK: typeID = mlir::TypeID::get<mlir::IntegerType>()
# CHECK: members of mlir::detail::IntegerTypeStorage
# CHECK-LABEL: +print FloatType
print FloatType
# CHECK: mlir::Float32Type
# CHECK: typeID = mlir::TypeID::get<mlir::Float32Type>()
# CHECK-LABEL: +print MemRefType
print MemRefType
# CHECK: mlir::MemRefType
# CHECK: shape = llvm::ArrayRef of length 2 = {4, 5}
# CHECK: elementType
# CHECK: mlir::Float32Type
# CHECK: typeID = mlir::TypeID::get<mlir::MemRefType>()
# CHECK: members of mlir::detail::MemRefTypeStorage
# CHECK-LABEL: +print UnrankedMemRefType
print UnrankedMemRefType
# CHECK: mlir::UnrankedMemRefType
# CHECK: elementType
# CHECK: mlir::IntegerType
# CHECK: memorySpace
# CHECK: 6
# CHECK: typeID = mlir::TypeID::get<mlir::UnrankedMemRefType>()
# CHECK: members of mlir::detail::UnrankedMemRefTypeStorage
# CHECK-LABEL: +print VectorType
print VectorType
# CHECK: mlir::VectorType
# CHECK: shape = llvm::ArrayRef of length 2 = {1, 2}
# CHECK: typeID = mlir::TypeID::get<mlir::VectorType>()
# CHECK: members of mlir::detail::VectorTypeStorage
# CHECK-LABEL: +print TupleType
print TupleType
# CHECK: mlir::TupleType
# CHECK: numElements = 2
# CHECK: typeID = mlir::TypeID::get<mlir::TupleType>()
# CHECK: elements[0]
# CHECK: mlir::IndexType
# CHECK-NEXT: typeID = mlir::TypeID::get<mlir::IndexType>()
# CHECK: elements[1]
# CHECK: mlir::Float32Type
# CHECK-NEXT: typeID = mlir::TypeID::get<mlir::Float32Type>()
# CHECK-LABEL: +print Result
print Result
# CHECK: mlir::Float32Type
# CHECK: typeID = mlir::TypeID::get<mlir::Float32Type>()
# CHECK: outOfLineIndex = 42
# CHECK-LABEL: +print Value
print Value
# CHECK: OutOfLineOpResult
# CHECK: typeID = mlir::TypeID::get<mlir::Float32Type>()
# CHECK: mlir::detail::ValueImpl::Kind::OutOfLineOpResult
# CHECK-LABEL: +print UnknownLoc
print UnknownLoc
# CHECK: mlir::UnknownLoc
# CHECK: typeID = mlir::TypeID::get<mlir::UnknownLoc>()
# CHECK-LABEL: +print FileLineColLoc
print FileLineColLoc
# CHECK: mlir::FileLineColLoc
# CHECK: typeID = mlir::TypeID::get<mlir::FileLineColLoc>()
# CHECK: members of mlir::detail::FileLineColLocAttrStorage
# CHECK: "file"
# CHECK: line = 7
# CHECK: column = 8
# CHECK-LABEL: +print OpaqueLoc
print OpaqueLoc
# CHECK: mlir::OpaqueLoc
# CHECK: typeID = mlir::TypeID::get<mlir::OpaqueLoc>()
# CHECK: members of mlir::detail::OpaqueLocAttrStorage
# CHECK: underlyingLocation = 9
# CHECK-LABEL: +print NameLoc
print NameLoc
# CHECK: mlir::NameLoc
# CHECK: typeID = mlir::TypeID::get<mlir::NameLoc>()
# CHECK: members of mlir::detail::NameLocAttrStorage
# CHECK: "foo"
# CHECK: mlir::UnknownLoc
# CHECK: typeID = mlir::TypeID::get<mlir::UnknownLoc>()
# CHECK-LABEL: +print CallSiteLoc
print CallSiteLoc
# CHECK: mlir::CallSiteLoc
# CHECK: callee
# CHECK: mlir::FileLineColLoc
# CHECK: caller
# CHECK: mlir::OpaqueLoc
# CHECK: typeID = mlir::TypeID::get<mlir::CallSiteLoc>()
# CHECK: members of mlir::detail::CallSiteLocAttrStorage
# CHECK: typeID = mlir::TypeID::get<mlir::FileLineColLoc>()
# CHECK: typeID = mlir::TypeID::get<mlir::OpaqueLoc>()
# CHECK-LABEL: +print FusedLoc
print FusedLoc
# CHECK: mlir::FusedLoc
# CHECK: typeID = mlir::TypeID::get<mlir::FusedLoc>()
# CHECK: members of mlir::detail::FusedLocAttrStorage
# CHECK: locations = llvm::ArrayRef of length 2
# CHECK: mlir::FileLineColLoc
# CHECK: mlir::NameLoc
# CHECK: typeID = mlir::TypeID::get<mlir::FileLineColLoc>()
# CHECK: typeID = mlir::TypeID::get<mlir::NameLoc>()
# CHECK-LABEL: +print UnitAttr
print UnitAttr
# CHECK: mlir::UnitAttr
# CHECK: typeID = mlir::TypeID::get<mlir::UnitAttr>()
# CHECK-LABEL: +print FloatAttr
print FloatAttr
# CHECK: mlir::FloatAttr
# CHECK: typeID = mlir::TypeID::get<mlir::FloatAttr>()
# CHECK: members of mlir::detail::FloatAttrStorage
# CHECK-LABEL: +print IntegerAttr
print IntegerAttr
# CHECK: mlir::IntegerAttr
# CHECK: typeID = mlir::TypeID::get<mlir::IntegerAttr>()
# CHECK: members of mlir::detail::IntegerAttrStorage
# CHECK-LABEL: +print TypeAttr
print TypeAttr
# CHECK: mlir::TypeAttr
# CHECK: mlir::IndexType
# CHECK: typeID = mlir::TypeID::get<mlir::TypeAttr>()
# CHECK: members of mlir::detail::TypeAttrStorage
# CHECK: typeID = mlir::TypeID::get<mlir::IndexType>()
# CHECK-LABEL: +print ArrayAttr
print ArrayAttr
# CHECK: mlir::ArrayAttr
# CHECK: typeID = mlir::TypeID::get<mlir::ArrayAttr>()
# CHECK: members of mlir::detail::ArrayAttrStorage
# CHECK: llvm::ArrayRef of length 1
# CHECK: mlir::UnitAttr
# CHECK: typeID = mlir::TypeID::get<mlir::UnitAttr>()
# CHECK-LABEL: +print StringAttr
print StringAttr
# CHECK: mlir::StringAttr
# CHECK: typeID = mlir::TypeID::get<mlir::StringAttr>()
# CHECK: members of mlir::detail::StringAttrStorage
# CHECK: value = "foo"
# CHECK-LABEL: +print ElementsAttr
print ElementsAttr
# CHECK: mlir::DenseIntOrFPElementsAttr
# CHECK: typeID = mlir::TypeID::get<mlir::DenseIntOrFPElementsAttr>()
# CHECK: members of mlir::detail::DenseIntOrFPElementsAttrStorage