-
Notifications
You must be signed in to change notification settings - Fork 13.5k
clang crashes at -Os on x86_64-linux-gnu: Assertion `... " VPlan cost model and legacy cost model disagreed"' failed #131359
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
Comments
Here is another case that triggers the same crash at int a, b;
char c;
void f(int g) {
int d;
for (int e = 0; e < g; e++)
d = e;
a = d;
}
void h() {
if (c)
b = 0;
else
b = 1;
f(b + 42);
}
void main() {} Compiler Explorer: https://godbolt.org/z/zY6GT5eox |
Fixes llvm#131359 After llvm#129645, a first-order recurrence will no longer have it's splice costed if the VPInstruction::FirstOrderRecurrenceSplice has no users and is dead. The legacy cost model didn't account for this, so update this to avoid the "VPlan cost model and legacy cost model disagreed" assertion. Alternatively we could also account for this in planContainsAdditionalSimplifications
Hi @zhendongsu @cardigan1008, thanks for reporting/reducing/bisecting this. Can you confirm that this is fixed now after eef5ea0? |
Hi @lukel97 my case has been fixed. But the first case seems to still trigger the same crash at My clang version: clang version 21.0.0git (https://github.com/llvm/llvm-project.git b3c5031) |
@cardigan1008 Looks like that's a separate vplan-legacy cost model mismatch, it seems to be reproducible before 26324bc. I'll leave this issue open |
Add additional OR simplification to fix a divergence between legacy and VPlan-based cost model. This adds a new m_AllOnes matcher by generalizing specific_intval to int_pred_ty, which takes a predicate to check to support matching both specific APInts and other APInt predices, like isAllOnes. Fixes llvm/llvm-project#131359.
Add additional OR simplification to fix a divergence between legacy and VPlan-based cost model. This adds a new m_AllOnes matcher by generalizing specific_intval to int_pred_ty, which takes a predicate to check to support matching both specific APInts and other APInt predices, like isAllOnes. Fixes llvm#131359.
It appears to be a regression from 19.1.0 and affects 20.1.0 and later.
Compiler Explorer: https://godbolt.org/z/K3Y3zn4hP
The text was updated successfully, but these errors were encountered: