================
@@ -148,11 +148,19 @@ void
CIRGenBuilderTy::computeGlobalViewIndicesFromFlatOffset(
}
llvm_unreachable("offset was not found within the record");
})
- .Default([](mlir::Type otherTy) {
- llvm_unreachable("unexpected type");
- return otherTy; // Even though this is unreachable, we need to
- // return a type to satisfy the return type of the
- // lambda.
+ .Default([&](mlir::Type otherTy) -> mlir::Type {
----------------
adams381 wrote:
The type reaching here is an integer, not a pointer, so I added a
`cir::IntType` case and restored the `llvm_unreachable` default rather than a
pointer case. `applyOffset` passes the *pointee* of the GlobalViewAttr to the
navigator, and the only site that hands it a non-aggregate pointee is
`getAddrOfConstantStringFromLiteral`, which builds ptr-to-element (`!s8i` for
`const char *`). String-literal element types are always integral (`"…"`→i8,
`L"…"`→i32, `u"…"`→u16, `U"…"`→u32), and a declared array keeps its array
pointee and is consumed by the `ArrayType` case, so a pointer never reaches the
leaf on this path. Non-integer types still hit the unreachable.
https://github.com/llvm/llvm-project/pull/201705
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits