-
Notifications
You must be signed in to change notification settings - Fork 15.1k
[SCEV] Fix a hang introduced by collectForPHI #158153
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -364,3 +364,29 @@ body: | |
| exit: | ||
| ret void | ||
| } | ||
|
|
||
| define void @hang_due_to_unreachable_phi_inblock() personality ptr null { | ||
| bb: | ||
| br label %bb6 | ||
|
|
||
| self-loop: ; preds = %self-loop | ||
| %dead = invoke ptr null() | ||
| to label %self-loop unwind label %bb4 | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would be nice to replace this invoke + landingpad with simple branches (which I think should work?)
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I tried that, and it no longer hung on old opt. I might have gone too simple (I used a poison condition), but I suspect we might special case that idiom somewhere. I'll give it one more go before landing to be sure.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, trying multiple variants, up to an including volatile stores, doesn't seem to trip the hang any more. Not sure why we need the invoke, but we appear to.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh, I figured out the difference. This the loop which is actually infintte. The Depth on this example is 1. As a result, if the cycle we're looping on contains a conditional branch, we hit the NumCollectedConditions guard. Per the comment, it wasn't meant to be functional, but that explains why we hit this so rarely. |
||
|
|
||
| bb4: ; preds = %self-loop | ||
| %i5 = landingpad { ptr, i32 } | ||
| cleanup | ||
| br label %bb6 | ||
|
|
||
| bb6: ; preds = %bb4, %bb | ||
| %i7 = phi ptr [ null, %bb4 ], [ null, %bb ] | ||
| br label %bb8 | ||
|
|
||
| bb8: ; preds = %bb8, %bb6 | ||
| %i9 = phi ptr [ null, %bb8 ], [ null, %bb6 ] | ||
| %i11 = icmp eq ptr %i9, null | ||
| br i1 %i11, label %bb12, label %bb8 | ||
|
|
||
| bb12: ; preds = %bb8, %bb6 | ||
| ret void | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.