The verifier of llvm.mlir.addressof did not properly account for opaque pointers, that is, the pointer type not having an element type equal to the type of the referenced global or function. This patch fixes that by skipping the test for the element type if the pointer is opaque.
Details
Details
Diff Detail
Diff Detail
Event Timeline
mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp | ||
---|---|---|
1657–1659 | Still had to check for address space mismatch, regardless of whether the pointer is opaque, so I hoisted that check, gave it a more concrete error message and utilized an early return to skip the check of the element types | |
mlir/test/Dialect/LLVMIR/global.mlir | ||
76 | Think I had the intention of testing it remains a opaque pointer, but that is very much out of scope for this patch. |
Can you pull the getType() into a separate variable?
It also feels like we could wrap both of these ifs within a check for !getType().isOpaque().