Skip to content

Commit

Permalink
cmpxchg: Compare argument types using eqTypeModuloOpaquePtrs
Browse files Browse the repository at this point in the history
Because `llvm-pretty` permits opaque and non-opaque pointers to coexist, it is
possible for the first argument of `cmpxchg` to be an opaque pointer and the
second argument to be a non-opaque pointer (or vice versa). We don't want to
reject such scenarios, so we compare the types of the argument using
`eqTypeModuloOpaquePtrs`, a special form of type equality that treats opaque
and non-opaque pointers as being the same. See #177.

This requires bumping the `llvm-pretty` submodule to bring in the corresponding
changes from GaloisInc/llvm-pretty#110.
  • Loading branch information
RyanGlScott committed May 30, 2023
1 parent 0313fe9 commit 2e848a6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion llvm-pretty
2 changes: 1 addition & 1 deletion src/Data/LLVM/BitCode/IR/Function.hs
Original file line number Diff line number Diff line change
Expand Up @@ -868,7 +868,7 @@ parseFunctionBlockEntry _ t d (fromEntry -> Just r) = case recordCode r of
-- TODO: record size assertion
-- Assert.recordSizeGreater r (ix'' + 5)

when (typedType val /= typedType new) $ fail $ unlines $
when (typedType val `eqTypeModuloOpaquePtrs` typedType new) $ fail $ unlines $
[ "Mismatched value types:"
, "cmp value: " ++ show (typedValue val)
, "new value: " ++ show (typedValue new)
Expand Down

0 comments on commit 2e848a6

Please sign in to comment.