[all-commits] [llvm/llvm-project] 3be388: [mlir][VectorOps] Support string literals in `vect...
Benjamin Maxwell via All-commits
all-commits at lists.llvm.org
Tue Oct 24 01:34:29 PDT 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 3be3883e6d67bf908fd12b51219075293ebb3dff
https://github.com/llvm/llvm-project/commit/3be3883e6d67bf908fd12b51219075293ebb3dff
Author: Benjamin Maxwell <benjamin.maxwell at arm.com>
Date: 2023-10-24 (Tue, 24 Oct 2023)
Changed paths:
A mlir/include/mlir/Conversion/LLVMCommon/PrintCallHelper.h
M mlir/include/mlir/Dialect/LLVMIR/FunctionCallUtils.h
M mlir/include/mlir/Dialect/Vector/IR/VectorOps.td
M mlir/include/mlir/ExecutionEngine/CRunnerUtils.h
M mlir/lib/Conversion/ControlFlowToLLVM/ControlFlowToLLVM.cpp
M mlir/lib/Conversion/LLVMCommon/CMakeLists.txt
A mlir/lib/Conversion/LLVMCommon/PrintCallHelper.cpp
M mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVM.cpp
M mlir/lib/Dialect/LLVMIR/IR/FunctionCallUtils.cpp
M mlir/lib/ExecutionEngine/CRunnerUtils.cpp
M mlir/lib/ExecutionEngine/RunnerUtils.cpp
M mlir/test/Conversion/VectorToLLVM/vector-to-llvm.mlir
M mlir/test/Dialect/Vector/invalid.mlir
A mlir/test/Integration/Dialect/Vector/CPU/test-print-str.mlir
Log Message:
-----------
[mlir][VectorOps] Support string literals in `vector.print` (#68695)
Printing strings within integration tests is currently quite annoyingly
verbose, and can't be tucked into shared helpers as the types depend on
the length of the string:
```
llvm.mlir.global internal constant @hello_world("Hello, World!\0")
func.func @entry() {
%0 = llvm.mlir.addressof @hello_world : !llvm.ptr<array<14 x i8>>
%1 = llvm.mlir.constant(0 : index) : i64
%2 = llvm.getelementptr %0[%1, %1]
: (!llvm.ptr<array<14 x i8>>, i64, i64) -> !llvm.ptr<i8>
llvm.call @printCString(%2) : (!llvm.ptr<i8>) -> ()
return
}
```
So this patch adds a simple extension to `vector.print` to simplify
this:
```
func.func @entry() {
// Print a vector of characters ;)
vector.print str "Hello, World!"
return
}
```
Most of the logic for this is now shared with `cf.assert` which already
does something similar.
Depends on #68694
More information about the All-commits
mailing list