[llvm] [SandboxVec][BottomUpVec] Implement InstrMaps (PR #122848)
Jorge Gorbe Moya via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 16 14:14:10 PST 2025
================
@@ -0,0 +1,77 @@
+//===- InstructionMaps.h ----------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_TRANSFORMS_VECTORIZE_SANDBOXVEC_PASSES_INSTRUCTIONMAPS_H
+#define LLVM_TRANSFORMS_VECTORIZE_SANDBOXVEC_PASSES_INSTRUCTIONMAPS_H
+
+#include "llvm/ADT/ArrayRef.h"
+#include "llvm/ADT/DenseMap.h"
+#include "llvm/ADT/SmallSet.h"
+#include "llvm/ADT/SmallVector.h"
+#include "llvm/SandboxIR/Value.h"
+#include "llvm/Support/Casting.h"
+#include "llvm/Support/raw_ostream.h"
+
+namespace llvm::sandboxir {
+
+/// Maps the original instructions to the vectorized instrs and the reverse.
+/// For now an original instr can only map to a single vector.
+class InstrMaps {
+ /// A map from the original values that got combined into vectors, to the
+ /// vector value(s).
+ DenseMap<Value *, Value *> OrigToVectorMap;
+ /// A map from the vector value to a map of the original value to its lane.
+ /// Please note that for constant vectors, there may multiple original values
+ /// with the same lane, as they may be coming from vectorizing different
+ /// original values.
+ DenseMap<Value *, DenseMap<Value *, unsigned>> VectorToOrigLaneMap;
+
+public:
+ /// \Returns all the vector value that we got from vectorizing \p Orig, or
----------------
slackito wrote:
Is the "all" here a typo? The function only returns one value.
https://github.com/llvm/llvm-project/pull/122848
More information about the llvm-commits
mailing list