forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix emitting asm and object file output at the same time
The LLVM function to output file types that involve codegen can invalidate the IR while lowering. That means that the second time the IR is fed to those passes, it's invalid and the LLVM verifier complains. To workaround this, we can tell the function to skip the codegen passes the second time around. To do this, we tell it to start adding passes only after it has seen a pass that doesn't exist at all. Quite the hack, I know... Fixes rust-lang#24876
- Loading branch information
Showing
5 changed files
with
48 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
-include ../tools.mk | ||
|
||
all: | ||
$(RUSTC) -Copt-level=0 --emit=llvm-bc,llvm-ir,asm,obj,link test.rs | ||
$(RUSTC) -Copt-level=1 --emit=llvm-bc,llvm-ir,asm,obj,link test.rs | ||
$(RUSTC) -Copt-level=2 --emit=llvm-bc,llvm-ir,asm,obj,link test.rs | ||
$(RUSTC) -Copt-level=3 --emit=llvm-bc,llvm-ir,asm,obj,link test.rs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT | ||
// file at the top-level directory of this distribution and at | ||
// http://rust-lang.org/COPYRIGHT. | ||
// | ||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | ||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | ||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | ||
// option. This file may not be copied, modified, or distributed | ||
// except according to those terms. | ||
|
||
// Checks for issue #24876 | ||
|
||
fn main() { | ||
let mut v = 0; | ||
for i in 0..0 { | ||
v += i; | ||
} | ||
println!("{}", v) | ||
} |