-
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
Clean up treatment of fast-math flags during parsing #161
Conversation
@kquick, can you verify if this PR is sufficient to allow your PX4_Autopilot example from #158 (comment) to be parsed? It works for my (probably much smaller) test case, so I'm curious if that's enough to make your larger example work as well. |
Currently, `llvm-pretty-bc-parser` skips over fast-math flags when parsing. However, it was doing so incorrectly when parsing `FUNC_CODE_INST_CMP2` (i.e., `fcmp` instructions). Per the LLVM source code [here](https://github.com/llvm/llvm-project/blob/b0391dfc737ede147e128fe877045f61fc5e4905/llvm/lib/Bitcode/Reader/BitcodeReader.cpp#L4342-L4377), the fast-math flags are expected to come after all of the other fields, but the code in `llvm-pretty-bc-parser` was assuming that they would appear in the middle. See #158. I addresses this issue by parsing all of the other fields upfront and avoiding parsing the last part, which correspond to fast-math flags. While I was in town, I also made sure to add comments in every other place in the parser where we avoid parsing fast-math flags.
I'd try to check the PX4-Autopilot code myself, but I can't even figure out how to build that repo with |
In any case, this definitely fixes the bugs in #158 (comment) and #158 (comment), which are cropping up in SV-COMP benchmarks. In light of this, I'm going to go ahead and merge this. I'll leave #158 open as a reminder to check PX4_Autopilot. |
This bumps the `llvm-pretty` and `llvm-pretty-bc-parser` submodules to include the following changes: * GaloisInc/llvm-pretty#85 and GaloisInc/llvm-pretty-bc-parser#166, which adds support for the `freeze` instruction introduced in LLVM 12. * GaloisInc/llvm-pretty#84 and GaloisInc/llvm-pretty-bc-parser#164, which allows parsing `DIEnumerator`s on LLVM 12 or later. * GaloisInc/llvm-pretty#83 and GaloisInc/llvm-pretty-bc-parser#162, which allows parsing `DICompositeType`s on LLVM 12 or later. * GaloisInc/llvm-pretty-bc-parser#161, which allows parsing `fcmp` instructions with fast-math flags. The `freeze` instruction will require some changes in `crucible-llvm` to accommodate, but I will do that in a subsequent commit.
Currently,
llvm-pretty-bc-parser
skips over fast-math flags when parsing. However, it was doing so incorrectly when parsingFUNC_CODE_INST_CMP2
(i.e.,fcmp
instructions). Per the LLVM source code here, the fast-math flags are expected to come after all of the other fields, but the code inllvm-pretty-bc-parser
was assuming that they would appear in the middle. See #158.I addresses this issue by parsing all of the other fields upfront and avoiding parsing the last part, which correspond to fast-math flags. While I was in town, I also made sure to add comments in every other place in the parser where we avoid parsing fast-math flags.