[Mlir-commits] [mlir] [mlir][llvm] Add support for memset.inline (PR #115711)
Tobias Gysi
llvmlistbot at llvm.org
Tue Nov 12 04:28:23 PST 2024
================
@@ -21,6 +21,25 @@ llvm.func @memset() -> i32 {
// -----
+// CHECK-LABEL: llvm.func @memset_inline
+llvm.func @memset_inline() -> i32 {
+ // CHECK-DAG: %[[ALLOCA_LEN:.*]] = llvm.mlir.constant(1 : i32) : i32
+ // CHECK-DAG: %[[ALLOCA:.*]] = llvm.alloca %[[ALLOCA_LEN]] x i32
+ // CHECK-DAG: %[[MEMSET_VALUE:.*]] = llvm.mlir.constant(42 : i8) : i8
+ // After SROA, only one i32 will be actually used, so only 4 bytes will be set.
+ %0 = llvm.mlir.constant(1 : i32) : i32
+ %1 = llvm.alloca %0 x !llvm.array<10 x i32> {alignment = 8 : i64} : (i32) -> !llvm.ptr
+ %memset_value = llvm.mlir.constant(42 : i8) : i8
+ // 16 bytes means it will span over the first 4 i32 entries
----------------
gysit wrote:
```suggestion
// 16 bytes means it will span over the first 4 i32 entries.
```
ultra nit:
https://github.com/llvm/llvm-project/pull/115711
More information about the Mlir-commits
mailing list