-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Segfault/assertion failure/IR verification error due to non-dominated use of SSAValue #46408
Comments
The assertion occurs during emission of %412:
Turns out the destination SSAValue has been assigned already when a later block that refers to SSAValue(412) was emitted earlier in time:
This is because Lines 4907 to 4913 in b9b60fc
And indeed, this is spotted by our IR verification pass, which complains on a debug build that:
|
Some more digging (a good way to get familiar with this part of the compiler), here's the IR just before SROA:
The tuple constructed from %337 and %338 is deconstructed and forwarded to the use in block 82:
That's invalid because BB 82 isn't dominated by BB 77 (as reported by the verifier right after SROA)
|
Another breadcrumb: SROA checks whether the original scalar (e.g. %337) dominates every phi node that uses the aggregate. So here, %337 dominates %343, and the replacement happens. But %337 does not dominate BB 82 where the aggregate is finally used, and will be lifted to, and that is what trips up the verifier. A simple check if the leaves dominate the target statement works: diff --git a/base/compiler/ssair/passes.jl b/base/compiler/ssair/passes.jl
index 594b77b386..683927cca4 100644
--- a/base/compiler/ssair/passes.jl
+++ b/base/compiler/ssair/passes.jl
@@ -635,13 +635,30 @@ function perform_lifting!(compact::IncrementalCompact,
dominates_all = true
if lazydomtree !== nothing
domtree = get(lazydomtree)
+ if !dominates_ssa(compact, domtree, the_leaf_val, stmt_val)
+ dominates_all = false
+ else
for item in visited_phinodes
if !dominates_ssa(compact, domtree, the_leaf_val, item)
dominates_all = false
break
end
end
+ end ... but I'm not sure this is the best fix. Shouldn't there be another phi if there another path into the statements' block? I also don't see any goto's in the full IR. |
I would have expected that |
Thanks @maleadt, will check this out today |
As seen on PkgEval:
Looking at the
rr
trace, turns out we're passing garbage intosle_int
:Note the
undef
arguments.Running the above under an assertions build reveals a failed assertion that can be reduced to:
Bisected to #44557, so cc @ianatol.
The text was updated successfully, but these errors were encountered: