[PATCH] D104902: [OpaquePtr] Allow globals with opaque pointer value type
Duncan P. N. Exon Smith via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 25 11:27:34 PDT 2021
dexonsmith added a comment.
In D104902#2841332 <https://reviews.llvm.org/D104902#2841332>, @dexonsmith wrote:
> In D104902#2840987 <https://reviews.llvm.org/D104902#2840987>, @aeubanks wrote:
>
>> lgtm, though invalid-opaque-ptr.ll is failing and should probably be deleted
>
> I don't understand why the testcase was deleted. It seems to indicate a hole in the verifier. Isn't this still invalid IR?
>
> define void @f(ptr %a) {
> %b = bitcast ptr %a to ptr*
> ret void
> }
Ah, I see -- the parsed IR will be correct do to the change to `PointerType::get`. So this isn't a verifier bug, it's a parser bug.
Seems like you just need to update:
// Type ::= Type '*'
case lltok::star:
if (Result->isLabelTy())
return tokError("basic block pointers are invalid");
if (Result->isVoidTy())
return tokError("pointers to void are invalid - use i8* instead");
if (!PointerType::isValidElementType(Result))
return tokError("pointer to this type is invalid");
to have:
if (Result->isOpaquePointerTy())
return tokError("pointer to opaque pointer is invalid");
before the the call to isValidElementType.
You'd need to update the logic in the similar case below for `lltok::kw_addrspace` as well.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D104902/new/
https://reviews.llvm.org/D104902
More information about the llvm-commits
mailing list