[llvm] [SandboxVec] Add BottomUpVec test flag to build regions from metadata. (PR #111904)
Jorge Gorbe Moya via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 10 14:39:09 PDT 2024
================
@@ -0,0 +1,16 @@
+; RUN: opt -disable-output --passes=sandbox-vectorizer \
+; RUN: -sbvec-passes=print-instruction-count \
+; RUN: -sbvec-use-regions-from-metadata %s | FileCheck %s
+
+define i8 @foo(i8 %v0, i8 %v1) {
+ %t0 = add i8 %v0, 1, !sandboxvec !0
----------------
slackito wrote:
Instructions in a function are scanned in order and every time we reach an instruction with not-yet-seen-before region node, we create the region for it. If we swap the regions like this (if I understood the comment correctly):
```
define i8 @foo(i8 %v0, i8 %v1) {
%t0 = add i8 %v0, 1, !sandboxvec !1
%t1 = add i8 %t0, %v1, !sandboxvec !0
%t2 = add i8 %t1, %v1, !sandboxvec !1
ret i8 %t2
}
!0 = distinct !{!"sandboxregion"}
!1 = distinct !{!"sandboxregion"}
```
We'll see
```
InstructionCount: 2
InstructionCount: 1
```
(region `!1` is created first with `%t0` and pushed to the result vector, then `!0` is created with `%t1`, then `%t2` gets added to `!1`).
https://github.com/llvm/llvm-project/pull/111904
More information about the llvm-commits
mailing list