Skip to content

Commit

Permalink
disasm-test: Avoid llvm-as from crashing on mixed opaque/non-opaque p…
Browse files Browse the repository at this point in the history
…ointers

This bumps the `llvm-pretty` submodule to bring in the `fixupOpaquePtrs`
function from GaloisInc/llvm-pretty#110 and use it in the `disasm-test` test
suite. This is needed because we must give pretty-printed `llvm-pretty` ASTs to
`llvm-as`, which strictly forbids mixing opaque and non-opaque pointers. See #177.
  • Loading branch information
RyanGlScott committed Apr 23, 2023
1 parent d4b859f commit c977e14
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions disasm-test/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ cube = TS.mkCUBE
, "at-least-llvm12"
, "at-least-llvm13"
, "at-least-llvm14"
, "at-least-llvm15"
])
]
-- Somewhat unusually for tasty-sugar, we make the expectedSuffix the same
Expand Down Expand Up @@ -369,11 +370,12 @@ processBitCode _keep (Roundtrip roundtrip) pfx file = do
case e of
Left err -> X.throwIO (ParseError err)
Right m -> do
parsed <- printToTempFile "ll" (show (ppLLVM (ppModule m)))
let m' = AST.fixupOpaquePtrs m
parsed <- printToTempFile "ll" (show (ppLLVM (ppModule m')))
-- stripComments _keep parsed
if roundtrip
then do
tmp2 <- printToTempFile "ast" (ppShow (normalizeModule m))
tmp2 <- printToTempFile "ast" (ppShow (normalizeModule m'))
return (parsed, Just tmp2)
else return (parsed, Nothing)

Expand Down
2 changes: 1 addition & 1 deletion llvm-pretty

0 comments on commit c977e14

Please sign in to comment.