# LLVM: fix calling convention lowering involving pointers · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/f31f86a86a482267a524cdca59fb2b940ecadf25)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: f31f86a86a482267a524cdca59fb2b940ecadf25

Requested commit: f31f86a86a482267a524cdca59fb2b940ecadf25

Commit: f31f86a86a482267a524cdca59fb2b940ecadf25

Tree: 8b23b571343ad7c89d5731f37a981c0ad2b91380

Author: Andrew Kelley

Committer: Andrew Kelley

## Message

```
LLVM: fix calling convention lowering involving pointers

The previous commit caused LLVM module verification failure because we
attemped to bitcast LLVM pointers to i64 parameters. This is exactly
what we want, however it's technically not allowed according to LLVM's
type system. It could have been fixed trivially by using ptrtoint
instead of bitcast in the case of pointers, however, out of concern for
inttoptr being problematic for the optimizer, I put in special code to
detect when a given parameter can be treated as its actual type rather
than an integer type. This makes Zig's output LLVM IR closer to what
Clang outputs.

```

## Parents

- [1697a6f0443ca8896081f98bd8648bc7bdb2cc58](https://git.cafe/gitcafe/zig/commit/1697a6f0443ca8896081f98bd8648bc7bdb2cc58?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/f31f86a86a482267a524cdca59fb2b940ecadf25?format=markdown)
