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

SimplifyCFG: Avoid miscompilations due to removed lifetime intrinsics #19

Closed
wants to merge 1 commit into from
Closed

Conversation

dotdash
Copy link

@dotdash dotdash commented Jul 29, 2014

This fixes rust-lang/rust#15972 and rust-lang/rust#16011. It's up for upstream review at http://reviews.llvm.org/D4699

For example in a loop, just removing a lifetime.end intrinsic can
interact badly with loop rotation, which might move the corresponding
lifetime.start intrinsic to the end of the loop.

So with the lifetime.end intrinsic removed you can end up with something
like:

    block:
        store i8 %foo, i8* %bar
        call void @llvm.lifetime.start(i64 1, i8* %bar)

Without a corresponding lifetime.end, meaning that the store is invalid.
If the lifetime.end intrinsic is kept, we get this instead:

    block:
        store i8 %foo, i8* %bar
        call void @llvm.lifetime.end(i64 1, i8* %bar)
        call void @llvm.lifetime.start(i64 1, i8* %bar)

Which is fine, since the store is within a valid lifetime region.
@alexcrichton
Copy link
Member

@dotdash dotdash deleted the lifetime_misopt_rust branch January 17, 2015 11:51
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants