[llvm] [Scalar] Dedicated pass for identifying redundant operations on packed bytes (PR #146364)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 3 14:21:40 PDT 2025
================
@@ -0,0 +1,1936 @@
+//===- PackedIntegerCombinePass.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
+//
+//===----------------------------------------------------------------------===//
+///
+/// This file provides the interface for LLVM's Packed Integer Combine pass.
+/// This pass tries to treat integers as packed chunks of individual bytes,
+/// and leverage this to coalesce needlessly fragmented
+/// computations.
+///
+//===----------------------------------------------------------------------===//
+
+#include "llvm/Transforms/Scalar/PackedIntegerCombinePass.h"
+#include "llvm/ADT/PostOrderIterator.h"
+#include "llvm/ADT/SetVector.h"
+#include "llvm/ADT/SmallBitVector.h"
+#include "llvm/ADT/SmallVector.h"
+#include "llvm/IR/IRBuilder.h"
+#include "llvm/IR/InstVisitor.h"
+#include "llvm/InitializePasses.h"
+#include "llvm/Pass.h"
+#include "llvm/Support/CommandLine.h"
+#include "llvm/Transforms/Scalar.h"
+
+using namespace llvm;
+
+#define DEBUG_TYPE "packedintcombine"
+
+static cl::opt<unsigned> MaxCollectionIterations(
+ "packedint-max-iterations",
+ cl::desc("Maximum number of iterations to isolate final packed "
+ "instructions. Set to 0 to iterate until convergence."),
+ cl::init(2), cl::Hidden);
+
+static cl::opt<bool>
+ AggressiveRewriting("packedint-aggressive-rewriter",
+ cl::desc("Aggressively rewrite packed instructions."),
+ cl::init(false), cl::Hidden);
----------------
zGoldthorpe wrote:
Sorry, I'm not really sure how to avoid `cl::opts` with the legacy pass manager (since `llc` seems to still use it).
https://github.com/llvm/llvm-project/pull/146364
More information about the llvm-commits
mailing list