[clang] [CIR][EH] Preserved exception pointer address spaces in throw calls (PR #227595)
Kunal Dubey via cfe-commits
cfe-commits at lists.llvm.org
Sun Nov 1 01:03:27 PST 2026
================
@@ -1681,11 +1681,16 @@ void CIRGenItaniumCXXABI::emitThrow(CIRGenFunction &cgf,
CharUnits exnAlign = cgf.getContext().getExnObjectAlignment();
cgf.emitAnyExprToExn(e->getSubExpr(), Address(exceptionPtr, exnAlign));
- // Get the RTTI symbol address.
- auto typeInfo = mlir::cast<cir::GlobalViewAttr>(
+ // Materialize the RTTI address as an SSA value. Device compilation may
+ // suppress RTTI emission, in which case this is a typed null pointer in the
+ // target's global address space instead of a view of an RTTI global.
+ auto typeInfoAttr = mlir::cast<mlir::TypedAttr>(
cgm.getAddrOfRTTIDescriptor(subExprLoc, clangThrowType,
/*forEH=*/true));
- assert(!typeInfo.getIndices() && "expected no indirection");
+ if (auto globalView = mlir::dyn_cast<cir::GlobalViewAttr>(typeInfoAttr))
----------------
xakep8 wrote:
This makes perfect sense I was only accounting for the null RTTI and totally missed this part, thanks for the catch. I have moved the RTTI globals and refs to global address space this also needed some changes to the vtable and lowering paths.
https://github.com/llvm/llvm-project/pull/227595
More information about the cfe-commits
mailing list