Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upRustc 1.12.0 Windows build of `ethcore` crate fails with LLVM error #36924
Comments
rphmeier
changed the title
Rustc 1.12.0 Windows build of `ethcore` crate
Rustc 1.12.0 Windows build of `ethcore` crate fails with LLVM error
Oct 3, 2016
This comment has been minimized.
This comment has been minimized.
|
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? |
This comment has been minimized.
This comment has been minimized.
|
@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... |
arielb1
self-assigned this
Oct 3, 2016
This comment has been minimized.
This comment has been minimized.
|
This may well be related to MIR, as well. |
This comment has been minimized.
This comment has been minimized.
|
Confirmed a MIR issue: build succeeds with |
alexcrichton
added
the
A-mir
label
Oct 4, 2016
This comment has been minimized.
This comment has been minimized.
|
@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? |
This comment has been minimized.
This comment has been minimized.
|
@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 |
nikomatsakis
referenced this issue
Oct 4, 2016
Closed
1.12.0: High memory usage when linking in release mode with debug info #36926
This comment has been minimized.
This comment has been minimized.
|
So I am able to reproduce this. Interestingly, debug builds don't seem to encounter the issue. |
This comment has been minimized.
This comment has been minimized.
|
Huh, somewhat frustratingly, this...stopped reproducing for now. Not sure what is different now! |
This comment has been minimized.
This comment has been minimized.
|
Ah, I see, cargo build must be run from the |
This comment has been minimized.
This comment has been minimized.
|
Compiling |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
The problematic function seems to be I think dropping zeroing might have |
This comment has been minimized.
This comment has been minimized.
|
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 |
This comment has been minimized.
This comment has been minimized.
|
Crashing IR available at |
brson
added
the
P-high
label
Oct 6, 2016
This comment has been minimized.
This comment has been minimized.
majnemer
commented
Oct 6, 2016
•
|
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 |
This comment has been minimized.
This comment has been minimized.
majnemer
commented
Oct 6, 2016
•
|
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); |
This comment has been minimized.
This comment has been minimized.
|
Is there an LLVM issue/PR for it? |
nikomatsakis
removed
the
I-nominated
label
Oct 6, 2016
This comment has been minimized.
This comment has been minimized.
|
Patch appears to fix problem (on Linux at least). |
This comment has been minimized.
This comment has been minimized.
majnemer
commented
Oct 7, 2016
|
Fixed in LLVM r283517. |
arielb1
referenced this issue
Oct 8, 2016
Merged
llvm: Update LLVM to include fix for pathologic case in its LiveDebugValues pass. #37030
arielb1
referenced this issue
Oct 8, 2016
Merged
Backport "[SimplifyCFG] Correctly test for unconditional branches in GetCaseResults" #54
This comment has been minimized.
This comment has been minimized.
|
This should be fixed on nightly builds now, right? I think we're just waiting on a backport? |
This comment has been minimized.
This comment has been minimized.
|
Sure. |
This comment has been minimized.
This comment has been minimized.
|
I believe #37030 is the PR that fixes this. Not backported yet. |
This comment has been minimized.
This comment has been minimized.
|
This is fixed by the SimplifyCfg PR, which was backported (that got merged into rustc PR #37030). |
rphmeier commentedOct 3, 2016
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.