-
Notifications
You must be signed in to change notification settings - Fork 12.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
opt segfault in JumpThreadingPass
#63013
Labels
Comments
EugeneZelenko
added
llvm:optimizations
crash
Prefer [crash-on-valid] or [crash-on-invalid]
and removed
new issue
labels
May 30, 2023
; RUN: opt -S -passes=jump-threading < %s
define void @test(i16 %_5.0._5.0.) {
start:
br label %bb5
bb20: ; preds = %bb19, %bb17, %bb17, %bb14, %bb13
ret void
bb5: ; preds = %bb16, %bb10, %bb10, %bb8, %start
%_11.0 = phi ptr [ %_11.5, %bb16 ], [ null, %bb10 ], [ null, %bb8 ], [ null, %bb10 ], [ null, %start ]
br label %bb8
bb8: ; preds = %bb15, %bb9, %bb5
%_6.sroa.0.0._6.sroa.0.0._6.sroa.0.0.8 = load i16, ptr null, align 2
%i = icmp eq i16 %_6.sroa.0.0._6.sroa.0.0._6.sroa.0.0.8, 0
br i1 %i, label %bb9, label %bb5
bb9: ; preds = %bb8
switch i16 %_6.sroa.0.0._6.sroa.0.0._6.sroa.0.0.8, label %bb8 [
i16 1, label %bb10
i16 0, label %bb13
]
bb10: ; preds = %bb14, %bb13, %bb9
%_2.7 = phi ptr [ %_11.0, %bb14 ], [ %_11.0, %bb13 ], [ null, %bb9 ]
%i1 = getelementptr { i128, i8 }, ptr %_11.0, i64 0, i32 1
store i8 0, ptr %i1, align 8
%i2 = load i128, ptr %_2.7, align 8
%i3 = icmp eq i128 %i2, 0
br i1 %i3, label %bb5, label %bb5
bb13: ; preds = %bb14, %bb9
switch i128 0, label %bb20 [
i128 0, label %bb10
i128 1, label %bb14
]
bb14: ; preds = %bb19, %bb13
switch i16 %_5.0._5.0., label %bb20 [
i16 0, label %bb13
i16 2, label %bb10
i16 1, label %bb15
]
bb15: ; preds = %bb14
switch i16 %_5.0._5.0., label %bb16 [
i16 1, label %bb8
i16 0, label %bb17
]
bb16: ; preds = %bb19, %bb15
%_11.5 = phi ptr [ null, %bb15 ], [ null, %bb19 ]
br label %bb5
bb17: ; preds = %bb19, %bb15
switch i16 %_5.0._5.0., label %bb20 [
i16 0, label %bb20
i16 1, label %bb19
]
bb19: ; preds = %bb17
switch i16 %_5.0._5.0., label %bb16 [
i16 0, label %bb14
i16 1, label %bb20
i16 6570, label %bb17
]
} We're crashing because
|
veselypeta
pushed a commit
to veselypeta/cherillvm
that referenced
this issue
Aug 27, 2024
Conservatively return unknown in this degenerate case. This is hard to hit in practice, because such phis are usually optimized away before they reach a getObjectSize() call. Fixes llvm/llvm-project#63013.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Using
-O2
with opthttps://godbolt.org/z/3K5EPaq8c
Using LLVM 16.0.0 from godbolt
For completeness, the LLVM IR was from the following Rust program written in custom Mid-level IR. It was machine generated and then minimised so not very readable and the variables and basic block labels are all out of order (they're parsed as arbitrary identifiers). Nonetheless LLVM shouldn't crash.
Rust custom MIR
% rustc --crate-type=lib -Copt-level=2 llvm-segfault/272124-mir.rs
The text was updated successfully, but these errors were encountered: