-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[LLVM] convergence verifier should visit all instructions #66200
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 |
---|---|---|
|
@@ -126,13 +126,18 @@ define void @entry_in_convergent(i32 %x, i32 %y) { | |
} | ||
|
||
; CHECK: Loop intrinsic cannot be preceded by a convergent operation in the same basic block. | ||
; CHECK: %t60_tok3 | ||
; CHECK-NEXT: %h1 | ||
; CHECK-SAME: %t60_tok3 | ||
define void @loop_at_start(i32 %x, i32 %y) convergent { | ||
A: | ||
%t60_tok3 = call token @llvm.experimental.convergence.entry() | ||
br label %B | ||
B: | ||
%z = add i32 %x, %y | ||
; This is not an error | ||
%h2 = call token @llvm.experimental.convergence.loop() [ "convergencectrl"(token %t60_tok3) ] | ||
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. Maybe make that explicit with a CHECK-NOT: %h2? 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. That's what the "CHECK-NEXT: %h1" does. It ensures that the error message is for %h1 and not %h2. There is not enough context in the stream of error messages to put a CHECK-NOT here. |
||
br label %C | ||
C: | ||
call void @f() | ||
%h1 = call token @llvm.experimental.convergence.loop() [ "convergencectrl"(token %t60_tok3) ] | ||
ret void | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If only calls can be convergent, I'm not sure I see how this is different. I don't really expect a visit instruction for the verifier to be side effecting. Can you have a separate enter block visitor?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The ConvergenceVerifier may also keep record of the last-call-instruction's parent. Then it is easy to detect entering a new block inside ConvergenceVerifier::visit(). I have no opinion which is the best way to way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed this by adding a visitBlock() method to the convergence verifier.