-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
llvm-20: Nightly compile time regression building comrak
with release profile
#137909
Comments
This is not a hang, the build completes after 20 minutes (phew). |
This can be somewhat "minimized" to just It's a huge match statement, and I would guess codegen takes polynomial time somehow? Having all 128 match arms, but deleting either arm 2 ( Minimized further: #[no_mangle]
pub fn autolink_email(s: &[u8]) -> Option<usize> {
let mut cursor = 0;
let mut marker = 0;
let len = s.len();
let mut yych: u8 = 0;
let mut yystate: usize = 0;
'yyl: loop {
match yystate {
0 => {
return None;
}
1 => {
// changing this to `return cursor`, the above to `return 1234` and the return type to `->usize`
// makes the code compile fast again
return Some(cursor);
}
2 => match yych {
_ => {
yystate = 6;
continue 'yyl;
}
},
3 => {
marker = cursor;
continue 'yyl;
}
4 => {
cursor = marker;
yystate = 2;
continue 'yyl;
}
// add some extra copies of the block if your machine is too fast to notice the slowdown
10 => {
yych = unsafe { if cursor < len { *s.get_unchecked(cursor) } else { 0 } };
continue 'yyl;
}
11 => {
yych = unsafe { if cursor < len { *s.get_unchecked(cursor) } else { 0 } };
continue 'yyl;
}
12 => {
yych = unsafe { if cursor < len { *s.get_unchecked(cursor) } else { 0 } };
continue 'yyl;
}
13 => {
yych = unsafe { if cursor < len { *s.get_unchecked(cursor) } else { 0 } };
continue 'yyl;
}
14 => {
yych = unsafe { if cursor < len { *s.get_unchecked(cursor) } else { 0 } };
continue 'yyl;
}
15 => {
yych = unsafe { if cursor < len { *s.get_unchecked(cursor) } else { 0 } };
continue 'yyl;
}
16 => {
yych = unsafe { if cursor < len { *s.get_unchecked(cursor) } else { 0 } };
continue 'yyl;
}
17 => {
yych = unsafe { if cursor < len { *s.get_unchecked(cursor) } else { 0 } };
continue 'yyl;
}
18 => {
yych = unsafe { if cursor < len { *s.get_unchecked(cursor) } else { 0 } };
continue 'yyl;
}
19 => {
yych = unsafe { if cursor < len { *s.get_unchecked(cursor) } else { 0 } };
continue 'yyl;
}
20 => {
yych = unsafe { if cursor < len { *s.get_unchecked(cursor) } else { 0 } };
continue 'yyl;
}
21 => {
yych = unsafe { if cursor < len { *s.get_unchecked(cursor) } else { 0 } };
continue 'yyl;
}
22 => {
yych = unsafe { if cursor < len { *s.get_unchecked(cursor) } else { 0 } };
continue 'yyl;
}
23 => {
yych = unsafe { if cursor < len { *s.get_unchecked(cursor) } else { 0 } };
continue 'yyl;
}
24 => {
yych = unsafe { if cursor < len { *s.get_unchecked(cursor) } else { 0 } };
continue 'yyl;
}
25 => {
yych = unsafe { if cursor < len { *s.get_unchecked(cursor) } else { 0 } };
continue 'yyl;
}
26 => {
yych = unsafe { if cursor < len { *s.get_unchecked(cursor) } else { 0 } };
continue 'yyl;
}
27 => {
yych = unsafe { if cursor < len { *s.get_unchecked(cursor) } else { 0 } };
continue 'yyl;
}
28 => {
yych = unsafe { if cursor < len { *s.get_unchecked(cursor) } else { 0 } };
continue 'yyl;
}
29 => {
yych = unsafe { if cursor < len { *s.get_unchecked(cursor) } else { 0 } };
continue 'yyl;
}
30 => {
yych = unsafe { if cursor < len { *s.get_unchecked(cursor) } else { 0 } };
continue 'yyl;
}
31 => {
yych = unsafe { if cursor < len { *s.get_unchecked(cursor) } else { 0 } };
continue 'yyl;
}
32 => {
yych = unsafe { if cursor < len { *s.get_unchecked(cursor) } else { 0 } };
continue 'yyl;
}
33 => {
yych = unsafe { if cursor < len { *s.get_unchecked(cursor) } else { 0 } };
continue 'yyl;
}
34 => {
yych = unsafe { if cursor < len { *s.get_unchecked(cursor) } else { 0 } };
continue 'yyl;
}
35 => {
yych = unsafe { if cursor < len { *s.get_unchecked(cursor) } else { 0 } };
continue 'yyl;
}
36 => {
yych = unsafe { if cursor < len { *s.get_unchecked(cursor) } else { 0 } };
continue 'yyl;
}
37 => {
yych = unsafe { if cursor < len { *s.get_unchecked(cursor) } else { 0 } };
continue 'yyl;
}
38 => {
yych = unsafe { if cursor < len { *s.get_unchecked(cursor) } else { 0 } };
continue 'yyl;
}
39 => {
yych = unsafe { if cursor < len { *s.get_unchecked(cursor) } else { 0 } };
continue 'yyl;
}
// regular `panic!()` also works, but a `return` doesn't
_ => unsafe{ core::hint::unreachable_unchecked() },
}
}
}
fn main() {} llvm passes timings:
|
WG-prioritization assigning priority (Zulip discussion). @rustbot label -I-prioritize +P-high |
llvm bisects to llvm/llvm-project#96631 (with just |
The bisection this time is correct. Basically, this is due to the complexity of calculations involving phi nodes similar to The patch for the fix is roughly: diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp
index e3e026f7979d..9b098bcb28bc 100644
--- a/llvm/lib/Analysis/ValueTracking.cpp
+++ b/llvm/lib/Analysis/ValueTracking.cpp
@@ -7824,6 +7824,8 @@ static bool isGuaranteedNotToBeUndefOrPoison(
unsigned Num = PN->getNumIncomingValues();
bool IsWellDefined = true;
for (unsigned i = 0; i < Num; ++i) {
+ if (PN == PN->getIncomingValue(i))
+ continue;
auto *TI = PN->getIncomingBlock(i)->getTerminator();
if (!isGuaranteedNotToBeUndefOrPoison(PN->getIncomingValue(i), AC, TI,
DT, Depth + 1, Kind)) { |
Upstream issue: llvm/llvm-project#130110. |
Update to LLVM 20.1.1 Fixes rust-lang/rust#138212. Fixes rust-lang/rust#137909.
Building
comrak
withcargo build --release
seems to never finish on x86_64 (both on Windows and Linux). It normally builds on the stable channel on my machine in approximately 26 seconds.Bisect results:
searched nightlies: from nightly-2025-02-15 to nightly-2025-02-25
regressed nightly: nightly-2025-02-18
searched commit range: 5bc6231...ce36a96
regressed commit: ce36a96
bisected with cargo-bisect-rustc v0.6.9
Host triple: x86_64-pc-windows-msvc
Reproduce with:
cargo bisect-rustc --start=2025-02-15 --end=2025-02-25 --script "C:\\Program Files\\Git\\usr\\bin\\bash.exe" -- ./regress.sh
regress.sh
:@rustbot modify labels: +regression-from-stable-to-nightly -regression-untriaged
The text was updated successfully, but these errors were encountered: