-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Adjust bit cast instruction filter for DXIL Prepare pass #142678
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
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
0b6f346
first attempt
bob80905 b912dd4
fix while loop
bob80905 54a2c0b
add check label and check next
bob80905 006b6df
update test
bob80905 80d381e
force pointer type deduction
bob80905 f297a02
remove llvm:: namespace, and add alloca case
bob80905 fd6651b
adjust alloca logic and test
bob80905 b143548
fix args
bob80905 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
llvm/test/CodeGen/DirectX/noop_bitcast_global_array_type.ll
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
; RUN: opt -S --dxil-prepare %s | FileCheck %s | ||
|
||
; Test that global arrays do not get a bitcast instruction | ||
; after the dxil-prepare pass. | ||
|
||
target triple = "dxilv1.2-unknown-shadermodel6.2-compute" | ||
|
||
@inputTile.1dim = local_unnamed_addr addrspace(3) global [3 x float] zeroinitializer, align 2 | ||
|
||
; CHECK-LABEL: testload | ||
define float @testload() local_unnamed_addr { | ||
; NOTE: this would be "bitcast ptr addrspace(3)..." before the change that introduced this test, | ||
; after the dxil-prepare pass is run | ||
; CHECK-NEXT: load float, ptr addrspace(3) @inputTile.1dim, align 2 | ||
%v = load float, ptr addrspace(3) @inputTile.1dim, align 2 | ||
|
||
ret float %v | ||
} | ||
|
||
; CHECK-LABEL: teststore | ||
define void @teststore() local_unnamed_addr { | ||
; CHECK-next: store float 2.000000e+00, ptr addrspace(3) @inputTile.1dim, align 2 | ||
store float 2.000000e+00, ptr addrspace(3) @inputTile.1dim, align 2 | ||
|
||
ret void | ||
} | ||
|
||
; CHECK-LABEL: testGEPConst | ||
define float @testGEPConst() local_unnamed_addr { | ||
; CHECK-NEXT: load float, ptr addrspace(3) getelementptr (float, ptr addrspace(3) @inputTile.1dim, i32 1), align 4 | ||
%v = load float, ptr addrspace(3) getelementptr (float, ptr addrspace(3) @inputTile.1dim, i32 1), align 4 | ||
|
||
ret float %v | ||
} | ||
|
||
; CHECK-LABEL: testGEPNonConst | ||
define float @testGEPNonConst(i32 %i) local_unnamed_addr { | ||
; CHECK-NEXT: getelementptr float, ptr addrspace(3) @inputTile.1dim, i32 %i | ||
%gep = getelementptr float, ptr addrspace(3) @inputTile.1dim, i32 %i | ||
%v = load float, ptr addrspace(3) %gep | ||
|
||
ret float %v | ||
} | ||
|
||
; CHECK-LABEL: testAlloca | ||
define float @testAlloca(i32 %i) local_unnamed_addr { | ||
; CHECK-NEXT: alloca [3 x float], align 4 | ||
%arr = alloca [3 x float], align 4 | ||
; CHECK-NEXT: getelementptr [3 x float], ptr %arr, i32 1 | ||
%gep = getelementptr [3 x float], ptr %arr, i32 1 | ||
%v = load float, ptr %gep | ||
ret float %v | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.