-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[SPIR-V] Add pre-headers to loops. #75844
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
6a895f8
c1e18b8
b59ecf1
655dea6
3cdb3f7
6b069ec
5b1ce3a
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 |
---|---|---|
@@ -0,0 +1,66 @@ | ||
; RUN: llc -mtriple=spirv-unknown-unknown -O0 %s -o - | FileCheck %s | ||
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. Assuming this is a simple case that's already structured and validates, can you add a RUN line for
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. Fixed the test to generate "valid" SPIR-V (function returned an int instead of void, etc), but I cannot add this line just yet. There are branches, and no OpSelectionMerge/OpLoopMerge yet, so this is not a valid SPIR-V module. |
||
|
||
; CHECK-DAG: %[[#bool:]] = OpTypeBool | ||
; CHECK-DAG: %[[#uint:]] = OpTypeInt 32 0 | ||
; CHECK-DAG: %[[#uint_0:]] = OpConstant %[[#uint]] 0 | ||
|
||
define void @main() #1 { | ||
%1 = icmp ne i32 0, 0 | ||
br i1 %1, label %l1, label %l2 | ||
|
||
; CHECK: %[[#cond:]] = OpINotEqual %[[#bool]] %[[#uint_0]] %[[#uint_0]] | ||
; CHECK: OpBranchConditional %[[#cond]] %[[#l1_pre:]] %[[#l2_pre:]] | ||
|
||
; CHECK-DAG: %[[#l2_pre]] = OpLabel | ||
; CHECK-NEXT: OpBranch %[[#l2_header:]] | ||
|
||
; CHECK-DAG: %[[#l1_pre]] = OpLabel | ||
; CHECK-NEXT: OpBranch %[[#l1_header:]] | ||
|
||
l1: | ||
br i1 %1, label %l1_body, label %l1_end | ||
; CHECK-DAG: %[[#l1_header]] = OpLabel | ||
; CHECK-NEXT: OpBranchConditional %[[#cond]] %[[#l1_body:]] %[[#l1_end:]] | ||
|
||
l1_body: | ||
br label %l1_continue | ||
; CHECK-DAG: %[[#l1_body]] = OpLabel | ||
; CHECK-NEXT: OpBranch %[[#l1_continue:]] | ||
|
||
l1_continue: | ||
br label %l1 | ||
; CHECK-DAG: %[[#l1_continue]] = OpLabel | ||
; CHECK-NEXT: OpBranch %[[#l1_header]] | ||
|
||
l1_end: | ||
br label %end | ||
; CHECK-DAG: %[[#l1_end]] = OpLabel | ||
; CHECK-NEXT: OpBranch %[[#end:]] | ||
|
||
l2: | ||
br i1 %1, label %l2_body, label %l2_end | ||
; CHECK-DAG: %[[#l2_header]] = OpLabel | ||
; CHECK-NEXT: OpBranchConditional %[[#cond]] %[[#l2_body:]] %[[#l2_end:]] | ||
|
||
l2_body: | ||
br label %l2_continue | ||
; CHECK-DAG: %[[#l2_body]] = OpLabel | ||
; CHECK-NEXT: OpBranch %[[#l2_continue:]] | ||
|
||
l2_continue: | ||
br label %l2 | ||
; CHECK-DAG: %[[#l2_continue]] = OpLabel | ||
; CHECK-NEXT: OpBranch %[[#l2_header]] | ||
|
||
l2_end: | ||
br label %end | ||
; CHECK-DAG: %[[#l2_end]] = OpLabel | ||
; CHECK-NEXT: OpBranch %[[#end:]] | ||
|
||
end: | ||
ret void | ||
; CHECK-DAG: %[[#end]] = OpLabel | ||
; CHECK-NEXT: OpReturn | ||
} | ||
|
||
attributes #1 = { "hlsl.numthreads"="4,8,16" "hlsl.shader"="compute" convergent } |
Uh oh!
There was an error while loading. Please reload this page.