-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Invalid pretty output ptr*
#262
Comments
Yes, this is rather unfortunate. Before I discuss a possible fix for this, let me first provide some context as to how things became this way (feel free to skip to the bottom of this comment if you already know the story). The root of the issue is that, broadly speaking, there two situations where
(2) is the tricky case, since it's up to the LLVM parsing library to determine what type should go in the AST. Continuing the store i8 %0, ptr %1 Or, to use the pre-opaque pointer syntax: store i8 %0, i8* %1 The bitcode for this If we aimed to only support one particular version of LLVM, then this would be an easy choice, as we would simply pick For tools like Crucible, the consequences of this choice aren't that important, since it can handle both At the end of the day, producing ASTs with mixed opaque and non-opaque pointer types is asking for trouble, so I think we should exclusively use one or the other. Unfortunately, different LLVM versions only support certain pointer types, so we must be careful about which pointer type we pick. One possible solution would be to tweak Another possible way forward would be to add a configuration option that allows switching between one pointer type or the other. I'm slightly more fond of this idea, although we'd have to figure out what the right default setting should be. |
I think I have another case of needing more info:
llvm-as -> .bc -> llvm-disasm:
This is rejected by llvm-as:
llvm-as -> .bc -> llvm-dis:
There is no ptrtoint in the AST dump. I haven't analyzed the bitcode directly yet. |
I think that this is actually a separate issue, as it's possible to trigger this bug without the use of opaque pointers. See #266. |
Encountered some incorrect roundtripping. Here is a fairly minimal reproducer:
Assembling to bitcode, parsing with llvm-pretty-bc-parser and then pretty-printing with ppModule yields:
which contains invalid LLVM IR
ptr*
.Thanks to @kquick I now know I can avoid this problem by manually calling
fixupOpaquePtrs
, however, I wonder whether we should avoid producingPtrTo PtrOpaque
in the first place, on the fly?The text was updated successfully, but these errors were encountered: