[clang] [CIR] Support pointer-to-int global initializers (PR #220643)
Kunal Dubey via cfe-commits
cfe-commits at lists.llvm.org
Tue Sep 15 00:57:17 PDT 2026
================
@@ -839,14 +841,15 @@ mlir::Attribute ConstantLValueEmitter::tryEmit() {
// Convert to the appropriate type; this could be an lvalue for
// an integer. FIXME: performAddrSpaceCast
- if (mlir::isa<cir::PointerType>(destTy)) {
- if (auto attr = mlir::dyn_cast<mlir::Attribute>(value))
+ if (auto attr = mlir::dyn_cast<mlir::Attribute>(value)) {
+ if (auto gv = mlir::dyn_cast<cir::GlobalViewAttr>(attr))
----------------
xakep8 wrote:
It might not be of the correct type and can be pointer-typed but later it is retagged in the line below after the offset adjustment to the destination type. Also the global view flows from the tryEmitBase and we simply retag it to the destination type.
https://github.com/llvm/llvm-project/pull/220643
More information about the cfe-commits
mailing list