[llvm] [DirectX] Flatten arrays (PR #114332)

Justin Bogner via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 4 09:25:45 PST 2024


================
@@ -0,0 +1,194 @@
+; RUN: opt -S -dxil-flatten-arrays  %s | FileCheck %s
+
+; CHECK-LABEL: alloca_2d_test
+define void @alloca_2d_test ()  {
+    ; CHECK: alloca [9 x i32], align 4
+    ; CHECK-NOT: alloca [3 x [3 x i32]], align 4
----------------
bogner wrote:

This `CHECK-NOT:` isn't necessarily doing what you want here. If the unflattened alloca was left over before the replacement instead of after it wouldn't catch that. Might be more reliable to use `CHECK-NEXT:` and check the whole function:
```
; CHECK-LABEL: alloca_2d_test
; CHECK-NEXT: alloca [9 x i32], align 4
; CHECK-NEXT: ret void
```

https://github.com/llvm/llvm-project/pull/114332


More information about the llvm-commits mailing list