-
Notifications
You must be signed in to change notification settings - Fork 14.8k
[DirectX] Scalarize Allocas as part of data scalarization #140165
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 | ||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -8,12 +8,18 @@ | |||||||||||||||||||||||||||
define internal void @main() #1 { | ||||||||||||||||||||||||||||
; CHECK-LABEL: define internal void @main() { | ||||||||||||||||||||||||||||
; CHECK-NEXT: [[ENTRY:.*:]] | ||||||||||||||||||||||||||||
; CHECK-NEXT: [[DOTI0:%.*]] = load float, ptr getelementptr inbounds ([24 x float], ptr @StaticArr.scalarized.1dim, i32 1), align 16 | ||||||||||||||||||||||||||||
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. This was an unexpected test update, Both the before and after both look right. This behavior seems to have something to do with the fact that we aren't walking uses and doing 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. This is a little surprising but it seems fine. Do we also have tests where the GEP was a constant expression in the first place to make sure that that's still doing the right thing? 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. We do have a few test case and they are still passing: llvm-project/llvm/test/CodeGen/DirectX/scalar-load.ll Lines 22 to 28 in 66a2d4b
llvm-project/llvm/test/CodeGen/DirectX/scalar-load.ll Lines 53 to 58 in 66a2d4b
|
||||||||||||||||||||||||||||
; CHECK-NEXT: [[DOTI1:%.*]] = load float, ptr getelementptr (float, ptr getelementptr inbounds ([24 x float], ptr @StaticArr.scalarized.1dim, i32 1), i32 1), align 4 | ||||||||||||||||||||||||||||
; CHECK-NEXT: [[DOTI2:%.*]] = load float, ptr getelementptr (float, ptr getelementptr inbounds ([24 x float], ptr @StaticArr.scalarized.1dim, i32 1), i32 2), align 8 | ||||||||||||||||||||||||||||
; CHECK-NEXT: [[DOTI01:%.*]] = load float, ptr getelementptr inbounds ([24 x float], ptr @StaticArr.scalarized.1dim, i32 2), align 16 | ||||||||||||||||||||||||||||
; CHECK-NEXT: [[DOTI12:%.*]] = load float, ptr getelementptr (float, ptr getelementptr inbounds ([24 x float], ptr @StaticArr.scalarized.1dim, i32 2), i32 1), align 4 | ||||||||||||||||||||||||||||
; CHECK-NEXT: [[DOTI23:%.*]] = load float, ptr getelementptr (float, ptr getelementptr inbounds ([24 x float], ptr @StaticArr.scalarized.1dim, i32 2), i32 2), align 8 | ||||||||||||||||||||||||||||
; CHECK-NEXT: [[TMP0:%.*]] = getelementptr inbounds [24 x float], ptr @StaticArr.scalarized.1dim, i32 1 | ||||||||||||||||||||||||||||
; CHECK-NEXT: [[DOTI0:%.*]] = load float, ptr [[TMP0]], align 16 | ||||||||||||||||||||||||||||
; CHECK-NEXT: [[DOTI1:%.*]] = getelementptr float, ptr [[TMP0]], i32 1 | ||||||||||||||||||||||||||||
; CHECK-NEXT: [[DOTI11:%.*]] = load float, ptr [[DOTI1]], align 4 | ||||||||||||||||||||||||||||
; CHECK-NEXT: [[DOTI2:%.*]] = getelementptr float, ptr [[TMP0]], i32 2 | ||||||||||||||||||||||||||||
; CHECK-NEXT: [[DOTI22:%.*]] = load float, ptr [[DOTI2]], align 8 | ||||||||||||||||||||||||||||
; CHECK-NEXT: [[TMP1:%.*]] = getelementptr inbounds [24 x float], ptr @StaticArr.scalarized.1dim, i32 2 | ||||||||||||||||||||||||||||
; CHECK-NEXT: [[DOTI03:%.*]] = load float, ptr [[TMP1]], align 16 | ||||||||||||||||||||||||||||
; CHECK-NEXT: [[DOTI14:%.*]] = getelementptr float, ptr [[TMP1]], i32 1 | ||||||||||||||||||||||||||||
; CHECK-NEXT: [[DOTI15:%.*]] = load float, ptr [[DOTI14]], align 4 | ||||||||||||||||||||||||||||
; CHECK-NEXT: [[DOTI26:%.*]] = getelementptr float, ptr [[TMP1]], i32 2 | ||||||||||||||||||||||||||||
; CHECK-NEXT: [[DOTI27:%.*]] = load float, ptr [[DOTI26]], align 8 | ||||||||||||||||||||||||||||
; CHECK-NEXT: ret void | ||||||||||||||||||||||||||||
; | ||||||||||||||||||||||||||||
entry: | ||||||||||||||||||||||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
; RUN: opt -S -passes='dxil-data-scalarization' -mtriple=dxil-pc-shadermodel6.3-library %s | FileCheck %s --check-prefix=SCHECK | ||
; RUN: opt -S -passes='dxil-data-scalarization,dxil-flatten-arrays' -mtriple=dxil-pc-shadermodel6.3-library %s | FileCheck %s --check-prefix=FCHECK | ||
|
||
; CHECK-LABEL: alloca_2d__vec_test | ||
define void @alloca_2d__vec_test() local_unnamed_addr #2 { | ||
; SCHECK: alloca [2 x [4 x i32]], align 16 | ||
; FCHECK: alloca [8 x i32], align 16 | ||
%1 = alloca [2 x <4 x i32>], align 16 | ||
ret void | ||
} |
Uh oh!
There was an error while loading. Please reload this page.