Skip to content

Commit

Permalink
Merge branch 'master' into vr/enforce-32-bit-limit
Browse files Browse the repository at this point in the history
  • Loading branch information
Ptival authored Oct 12, 2021
2 parents 9bbb47d + f3ca4fb commit 6fb6a13
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/Data/LLVM/BitCode/IR/Function.hs
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,10 @@ parseFunctionBlockEntry _ t d (fromEntry -> Just r) = case recordCode r of
-- cause a loop.
useRelIds <- getRelIds
args <- parsePhiArgs useRelIds t r
-- XXX: we're ignoring the fast-math flags

when (even (length (recordFields r))) $ do
pure () -- TODO: fast math flags

result ty (Phi ty args) d

-- 17 is unused
Expand Down Expand Up @@ -1168,11 +1171,10 @@ parsePhiArgs relIds t r = loop 1
return (typedValue val,bid)

loop n
| n >= len = return []
| otherwise = do
entry <- parse n
rest <- loop (n+2)
return (entry:rest)
-- We must stop when @n@ is either equal to @len@, or to @len - 1@ in the
-- presence of fast math flags.
| len - n < 2 = return []
| otherwise = (:) <$> parse n <*> loop (n + 2)

-- | Parse the arguments for a call record.
parseCallArgs :: ValueTable -> Bool -> Record -> Int -> [Type] -> Parse [Typed PValue]
Expand Down

0 comments on commit 6fb6a13

Please sign in to comment.