Skip to content

Building coreutils with LTO causes LLVM error #28066

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
hexsel opened this issue Aug 28, 2015 · 6 comments
Closed

Building coreutils with LTO causes LLVM error #28066

hexsel opened this issue Aug 28, 2015 · 6 comments
Labels
A-linkage Area: linking into static, shared libraries and binaries A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.

Comments

@hexsel
Copy link

hexsel commented Aug 28, 2015

Building coreutils with LTO:

make ENABLE_LTO=y ENABLE_STRIP=y

causes the following error:

...
rustc -O -L /Users/gustavo.hexsel/Dev/coreutils/build/ -C lto --extern uufalse=/Users/gustavo.hexsel/Dev/coreutils/build/libfalse.rlib --extern uutrue=/Users/gustavo.hexsel/Dev/coreutils/build/libtrue.rlib --extern uutest=/Users/gustavo.hexsel/Dev/coreutils/build/libtest.rlib -o /Users/gustavo.hexsel/Dev/coreutils/build/fmt /Users/gustavo.hexsel/Dev/coreutils/build/gen/fmt.rs
Instruction does not dominate all uses!
  %oldret2 = insertvalue %str_slice %oldret, i64 %newret1, 1
  %.sink.i.i = phi %str_slice [ %oldret2, %"_ZN6string52String.ops..Index$LT$ops..RangeFrom$LT$usize$GT$$GT$5index20he25fda6b1269058b8bgE.exit.i.i" ], [ %oldret6, %"_ZN6string52String.ops..Index$LT$ops..RangeFrom$LT$usize$GT$$GT$5index20he25fda6b1269058b8bgE.exit61.i.i" ]
Instruction does not dominate all uses!
  %oldret6 = insertvalue %str_slice %oldret4, i64 %newret5, 1
  %.sink.i.i = phi %str_slice [ %oldret2, %"_ZN6string52String.ops..Index$LT$ops..RangeFrom$LT$usize$GT$$GT$5index20he25fda6b1269058b8bgE.exit.i.i" ], [ %oldret6, %"_ZN6string52String.ops..Index$LT$ops..RangeFrom$LT$usize$GT$$GT$5index20he25fda6b1269058b8bgE.exit61.i.i" ]
Instruction does not dominate all uses!
  %143 = invoke fastcc { i8*, i64 } @_ZN3str3str9trim_left20h2c4602b77c2e6481olfE(i8* noalias nonnull readonly %.pre-phi.i.i.58.i.i, i64 %142)
          to label %join7.i.i unwind label %unwind_ast_3291_.loopexit.split-lp.i
  %newret3 = extractvalue { i8*, i64 } %143, 0
Instruction does not dominate all uses!
  %143 = invoke fastcc { i8*, i64 } @_ZN3str3str9trim_left20h2c4602b77c2e6481olfE(i8* noalias nonnull readonly %.pre-phi.i.i.58.i.i, i64 %142)
          to label %join7.i.i unwind label %unwind_ast_3291_.loopexit.split-lp.i
  %newret5 = extractvalue { i8*, i64 } %143, 1
Instruction does not dominate all uses!
  %130 = invoke fastcc { i8*, i64 } @_ZN3str3str9trim_left20h2c4602b77c2e6481olfE(i8* noalias nonnull readonly %.pre-phi.i.i.i.i, i64 %129)
          to label %join7.i.i unwind label %unwind_ast_3291_.loopexit.split-lp.i
  %newret = extractvalue { i8*, i64 } %130, 0
Instruction does not dominate all uses!
  %130 = invoke fastcc { i8*, i64 } @_ZN3str3str9trim_left20h2c4602b77c2e6481olfE(i8* noalias nonnull readonly %.pre-phi.i.i.i.i, i64 %129)
          to label %join7.i.i unwind label %unwind_ast_3291_.loopexit.split-lp.i
  %newret1 = extractvalue { i8*, i64 } %130, 1
LLVM ERROR: Broken function found, compilation aborted!
make: *** [/Users/gustavo.hexsel/Dev/coreutils/build/fmt] Error 1

This error does not occur if you remove ENABLE_LTO=y.

This is on OSX, Rust version is rustc 1.4.0-nightly (63ba780fd 2015-08-23) (coreutils only builds on nightly).

@alexcrichton
Copy link
Member

I managed to "minimize this" which only uses the crates.io getopts library.

cc @nrc

@steveklabnik steveklabnik added A-linkage Area: linking into static, shared libraries and binaries A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. labels Sep 3, 2015
bors added a commit that referenced this issue Sep 21, 2015
This is useful for debugging LTO issues, #28066 for example.
@sanxiyn
Copy link
Member

sanxiyn commented Sep 22, 2015

Reduced this to <1 KiB LLVM IR and filed an LLVM bug at https://llvm.org/bugs/show_bug.cgi?id=24906

@sanxiyn
Copy link
Member

sanxiyn commented Sep 24, 2015

LLVM fix landed in r248387.

@huonw
Copy link
Member

huonw commented Jan 5, 2016

Has LLVM been updated recently/is this fixed?

@sanxiyn
Copy link
Member

sanxiyn commented Jan 6, 2016

This is not fixed but will be fixed by #30448.

@sanxiyn
Copy link
Member

sanxiyn commented Mar 11, 2016

Confirmed fixed for alexcrichton's reduction. nightly-2016-01-28 is bad, nightly-2016-01-30 is good.

@sanxiyn sanxiyn closed this as completed Mar 11, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-linkage Area: linking into static, shared libraries and binaries A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.
Projects
None yet
Development

No branches or pull requests

5 participants