-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Rustc 1.12.0 Windows build of ethcore
crate fails with LLVM error
#36924
Comments
ethcore
crate ethcore
crate fails with LLVM error
Historically most of these have been LLVM bugs, unfortunately, which are notoriously hard to track down. @rphmeier do you know if it'd be possible to minimize the test case at all? |
@alexcrichton yikes, I have no idea to be honest. Like I said, I haven't got a windows machine to test with and the test case as it stands is about 10-15k LoC on its own... |
This may well be related to MIR, as well. cc @rust-lang/compiler |
Confirmed a MIR issue: build succeeds with |
@rphmeier I am trying to get a windows setup up and going to test this and other reported problems (my previous Windows VM recently mysteriously lost its Network Driver and I've never been able to figure out how to get it back...). Any tips you can give me for reproducing it? I guess just a vanilla x86_64 MSVC configuration? |
@nikomatsakis Thanks for looking into this. A vanilla x86_64 MSVC setup sounds right. The appveyor.yml contains a few additional setup steps which you might find useful: https://github.com/ethcore/parity/blob/master/appveyor.yml |
So I am able to reproduce this. Interestingly, debug builds don't seem to encounter the issue. |
Huh, somewhat frustratingly, this...stopped reproducing for now. Not sure what is different now! |
Ah, I see, cargo build must be run from the |
Compiling |
The problematic function seems to be I think dropping zeroing might have |
The code that is optimized wrong looks like this, basically:
Somehow, it is optimized into this (that is not only simplifycfg, but also a fair bunch of other passes):
Where
cc @majnemer. See that %bb110 has no |
Crashing IR available at |
Reduced IR: target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-windows-msvc"
declare void @throw()
define void @bad_fn(i64 %val) personality i32 (...)* @__CxxFrameHandler3 {
entry:
invoke void @throw()
to label %unreachable unwind label %cleanup1
unreachable:
unreachable
cleanup1:
%cleanuppad1 = cleanuppad within none []
switch i64 %val, label %cleanupdone2 [
i64 0, label %cleanupdone1
i64 1, label %cleanupdone1
i64 6, label %cleanupdone1
]
cleanupdone1:
cleanupret from %cleanuppad1 unwind label %cleanup2
cleanupdone2:
cleanupret from %cleanuppad1 unwind label %cleanup2
cleanup2:
%phi = phi i1 [ true, %cleanupdone1 ], [ true, %cleanupdone2 ]
%cleanuppad2 = cleanuppad within none []
call void @throw() [ "funclet"(token %cleanuppad2) ]
unreachable
}
declare i32 @__CxxFrameHandler3(...) The bug can be reproduced using opt -simplifycfg |
The following patch fixes the reduced testcase, could you please test it? diff --git a/lib/Transforms/Utils/SimplifyCFG.cpp b/lib/Transforms/Utils/SimplifyCFG.cpp
index 90ce672..2702b76 100644
--- a/lib/Transforms/Utils/SimplifyCFG.cpp
+++ b/lib/Transforms/Utils/SimplifyCFG.cpp
@@ -4503,7 +4503,8 @@ GetCaseResults(SwitchInst *SI, ConstantInt *CaseVal, BasicBlock *CaseDest,
++I) {
if (TerminatorInst *T = dyn_cast<TerminatorInst>(I)) {
// If the terminator is a simple branch, continue to the next block.
- if (T->getNumSuccessors() != 1)
+ const auto *BI = dyn_cast<BranchInst>(T);
+ if (!BI || !BI->isUnconditional())
return false;
Pred = CaseDest;
CaseDest = T->getSuccessor(0); |
Is there an LLVM issue/PR for it? |
Patch appears to fix problem (on Linux at least). |
Fixed in LLVM r283517. |
This should be fixed on nightly builds now, right? I think we're just waiting on a backport? |
Sure. |
I believe #37030 is the PR that fixes this. Not backported yet. |
This is fixed by the SimplifyCfg PR, which was backported (that got merged into rustc PR #37030). |
Error produced:
As seen here: https://ci.appveyor.com/project/NikolayVolf/parity-g802m/build/1.3.0+1997#L640
Triggered by this update from 1.10.0 to 1.12.0: https://github.com/ethcore/parity/pull/2423
Either LLVM is broken or the generated IR is.
Feel free to change the title to something more descriptive. Unfortunately I haven't got a windows machine for testing, just the one broken appveyor build.
The text was updated successfully, but these errors were encountered: