Skip to content
This repository was archived by the owner on Feb 5, 2019. It is now read-only.

Remind LLVM about alloc function names in Rust #80

Merged
merged 1 commit into from
Jun 3, 2017

Conversation

nagisa
Copy link
Member

@nagisa nagisa commented Jun 3, 2017

Port and expansion of 4daef48

@alexcrichton alexcrichton merged commit 84c52ce into rust-lang:rust-llvm-2017-04-13 Jun 3, 2017
nagisa added a commit to nagisa/rust that referenced this pull request Jun 8, 2017
Includes rust-lang/llvm#80
Includes rust-lang/llvm#79

Also adds tests and thus fixes rust-lang#24194
@cuviper
Copy link
Member

cuviper commented Jun 8, 2017

Can you propose these additions to upstream LLVM? I want to patch our distro LLVM packages, but our maintainer would like some upstream review first.

I guess that depends in part on our own stability -- are these signatures ever expected to change?

@nagisa
Copy link
Member Author

nagisa commented Jun 8, 2017

@cuviper I would rather propose LLVM a patch that makes it possible to mark an arbitrary function as malloc-like, from the IR, rather than having to patch LLVM itself, but it would need time.

{LibFunc::rust_allocate, {MallocLike, 2, 0, -1}},
{LibFunc::rust_allocate_zeroed, {MallocLike, 2, 0, -1}},
{LibFunc::rust_reallocate, {ReallocLike, 4, 2, -1}},
{LibFunc::rust_reallocate_inplace, {ReallocLike, 4, 2, -1}}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is rust_reallocate_inplace really ReallocLike? realloc invalidates the old pointer on success (even if the block does not move), and rust_reallocate_inplace explicitly does not do that.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair point. reallocate_inplace does not return a pointer. I’ll remove it just to be safe.

@alexcrichton
Copy link
Member

I would rather propose LLVM a patch that makes it possible to mark an arbitrary function as malloc-like, from the IR, rather than having to patch LLVM itself, but it would need time.

This may exist today, although I'm not sure if that actually works.

bors added a commit to rust-lang/rust that referenced this pull request Jun 16, 2017
arielb1 pushed a commit that referenced this pull request Jun 27, 2017
Remind LLVM about alloc function names in Rust
TimNN added a commit that referenced this pull request Jul 20, 2017
Remind LLVM about alloc function names in Rust
TimNN added a commit that referenced this pull request Jul 20, 2017
Remind LLVM about alloc function names in Rust
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants