[llvm] [NFC] add anonymous to a couple classes (PR #121511)
Alex MacLean via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 2 10:19:49 PST 2025
https://github.com/AlexMaclean created https://github.com/llvm/llvm-project/pull/121511
This ensures these classes are visible only to the appropriate translation unit and allows for more optimizations.
>From bae974f4e1c2f89f8e84cec60bb168df0c2bbf97 Mon Sep 17 00:00:00 2001
From: Alex Maclean <amaclean at nvidia.com>
Date: Wed, 1 Jan 2025 22:49:16 +0000
Subject: [PATCH] [NFC] add anonymous to a couple classes missing it
---
llvm/lib/IR/SafepointIRVerifier.cpp | 2 ++
.../Transforms/AggressiveInstCombine/AggressiveInstCombine.cpp | 2 ++
2 files changed, 4 insertions(+)
diff --git a/llvm/lib/IR/SafepointIRVerifier.cpp b/llvm/lib/IR/SafepointIRVerifier.cpp
index ed99d05975c232..d32852b796c202 100644
--- a/llvm/lib/IR/SafepointIRVerifier.cpp
+++ b/llvm/lib/IR/SafepointIRVerifier.cpp
@@ -289,6 +289,7 @@ static void PrintValueSet(raw_ostream &OS, IteratorTy Begin, IteratorTy End) {
using AvailableValueSet = DenseSet<const Value *>;
+namespace {
/// State we compute and track per basic block.
struct BasicBlockState {
// Set of values available coming in, before the phi nodes
@@ -305,6 +306,7 @@ struct BasicBlockState {
// contribute to AvailableOut.
bool Cleared = false;
};
+} // namespace
/// A given derived pointer can have multiple base pointers through phi/selects.
/// This type indicates when the base pointer is exclusively constant
diff --git a/llvm/lib/Transforms/AggressiveInstCombine/AggressiveInstCombine.cpp b/llvm/lib/Transforms/AggressiveInstCombine/AggressiveInstCombine.cpp
index 45ee2d472a11b9..12ae6740e055ef 100644
--- a/llvm/lib/Transforms/AggressiveInstCombine/AggressiveInstCombine.cpp
+++ b/llvm/lib/Transforms/AggressiveInstCombine/AggressiveInstCombine.cpp
@@ -181,6 +181,7 @@ static bool foldGuardedFunnelShift(Instruction &I, const DominatorTree &DT) {
/// the bit indexes (Mask) needed by a masked compare. If we're matching a chain
/// of 'and' ops, then we also need to capture the fact that we saw an
/// "and X, 1", so that's an extra return value for that case.
+namespace {
struct MaskOps {
Value *Root = nullptr;
APInt Mask;
@@ -190,6 +191,7 @@ struct MaskOps {
MaskOps(unsigned BitWidth, bool MatchAnds)
: Mask(APInt::getZero(BitWidth)), MatchAndChain(MatchAnds) {}
};
+} // namespace
/// This is a recursive helper for foldAnyOrAllBitsSet() that walks through a
/// chain of 'and' or 'or' instructions looking for shift ops of a common source
More information about the llvm-commits
mailing list