Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions llvm/include/llvm/Analysis/TargetLibraryInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -373,12 +373,10 @@ class TargetLibraryInfo {
/// Disables all builtins.
///
/// This can be used for options like -fno-builtin.
void disableAllFunctions() LLVM_ATTRIBUTE_UNUSED {
OverrideAsUnavailable.set();
}
[[maybe_unused]] void disableAllFunctions() { OverrideAsUnavailable.set(); }

/// Forces a function to be marked as unavailable.
void setUnavailable(LibFunc F) LLVM_ATTRIBUTE_UNUSED {
[[maybe_unused]] void setUnavailable(LibFunc F) {
assert(F < OverrideAsUnavailable.size() && "out-of-bounds LibFunc");
OverrideAsUnavailable.set(F);
}
Expand Down
2 changes: 1 addition & 1 deletion llvm/include/llvm/CodeGen/LiveRangeCalc.h
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ class LiveRangeCalc {
/// jointly dominated by the blocks corresponding to the slot indices
/// in @p Defs. This function is mainly for use in self-verification
/// checks.
LLVM_ABI LLVM_ATTRIBUTE_UNUSED static bool
[[maybe_unused]] LLVM_ABI static bool
isJointlyDominated(const MachineBasicBlock *MBB, ArrayRef<SlotIndex> Defs,
const SlotIndexes &Indexes);
};
Expand Down
12 changes: 5 additions & 7 deletions llvm/include/llvm/Support/DebugLog.h
Original file line number Diff line number Diff line change
Expand Up @@ -221,12 +221,10 @@ constexpr ::llvm::StringRef strip_quotes(const char *Str) {
#define LDBG_GET_DEBUG_TYPE_STR() LDBG_GET_DEBUG_TYPE_STR_(DEBUG_TYPE)

/// Helper to call isCurrentDebugType with a StringRef.
static LLVM_ATTRIBUTE_UNUSED bool ldbgIsCurrentDebugType(StringRef Type,
int Level) {
[[maybe_unused]] static bool ldbgIsCurrentDebugType(StringRef Type, int Level) {
return ::llvm::isCurrentDebugType(Type.str().c_str(), Level);
}
static LLVM_ATTRIBUTE_UNUSED bool ldbgIsCurrentDebugType(int Level,
StringRef Type) {
[[maybe_unused]] static bool ldbgIsCurrentDebugType(int Level, StringRef Type) {
return ::llvm::isCurrentDebugType(Type.str().c_str(), Level);
}

Expand Down Expand Up @@ -302,7 +300,7 @@ class RAIINewLineStream final : public raw_ostream {
};

/// Remove the path prefix from the file name.
static LLVM_ATTRIBUTE_UNUSED constexpr const char *
[[maybe_unused]] static constexpr const char *
getShortFileName(const char *path) {
const char *filename = path;
for (const char *p = path; *p != '\0'; ++p) {
Expand All @@ -315,7 +313,7 @@ getShortFileName(const char *path) {
/// Compute the prefix for the debug log in the form of:
/// "[DebugType] File:Line "
/// Where the File is the file name without the path prefix.
static LLVM_ATTRIBUTE_UNUSED std::string
[[maybe_unused]] static std::string
computePrefix(StringRef DebugType, const char *File, int Line, int Level) {
std::string Prefix;
raw_string_ostream OsPrefix(Prefix);
Expand All @@ -326,7 +324,7 @@ computePrefix(StringRef DebugType, const char *File, int Line, int Level) {
return OsPrefix.str();
}
/// Overload allowing to swap the order of the DebugType and Level arguments.
static LLVM_ATTRIBUTE_UNUSED std::string
[[maybe_unused]] static std::string
computePrefix(int Level, const char *File, int Line, StringRef DebugType) {
return computePrefix(DebugType, File, Line, Level);
}
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/CodeGen/CodeGenPrepare.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -819,7 +819,7 @@ void CodeGenPrepare::removeAllAssertingVHReferences(Value *V) {
}

// Verify BFI has been updated correctly by recomputing BFI and comparing them.
void LLVM_ATTRIBUTE_UNUSED CodeGenPrepare::verifyBFIUpdates(Function &F) {
[[maybe_unused]] void CodeGenPrepare::verifyBFIUpdates(Function &F) {
DominatorTree NewDT(F);
LoopInfo NewLI(NewDT);
BranchProbabilityInfo NewBPI(F, NewLI, TLInfo);
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/CodeGen/MachineCopyPropagation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1257,7 +1257,7 @@ void MachineCopyPropagation::BackwardCopyPropagateBlock(
Tracker.clear();
}

static void LLVM_ATTRIBUTE_UNUSED printSpillReloadChain(
[[maybe_unused]] static void printSpillReloadChain(
DenseMap<MachineInstr *, SmallVector<MachineInstr *>> &SpillChain,
DenseMap<MachineInstr *, SmallVector<MachineInstr *>> &ReloadChain,
MachineInstr *Leader) {
Expand Down
4 changes: 2 additions & 2 deletions llvm/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,8 @@ DWARFDebugFrame::DWARFDebugFrame(Triple::ArchType Arch,

DWARFDebugFrame::~DWARFDebugFrame() = default;

static void LLVM_ATTRIBUTE_UNUSED dumpDataAux(DataExtractor Data,
uint64_t Offset, int Length) {
[[maybe_unused]] static void dumpDataAux(DataExtractor Data, uint64_t Offset,
int Length) {
errs() << "DUMP: ";
for (int i = 0; i < Length; ++i) {
uint8_t c = Data.getU8(&Offset);
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/ProfileData/InstrProf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ void ProfOStream::patch(ArrayRef<PatchItem> P) {

std::string getPGOFuncName(StringRef Name, GlobalValue::LinkageTypes Linkage,
StringRef FileName,
uint64_t Version LLVM_ATTRIBUTE_UNUSED) {
[[maybe_unused]] uint64_t Version) {
// Value names may be prefixed with a binary '1' to indicate
// that the backend should not modify the symbols due to any platform
// naming convention. Do not include that '1' in the PGO profile name.
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/Support/PrettyStackTrace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ extern "C" const char *__crashreporter_info__
asm(".desc ___crashreporter_info__, 0x10");
#endif

static void setCrashLogMessage(const char *msg) LLVM_ATTRIBUTE_UNUSED;
[[maybe_unused]] static void setCrashLogMessage(const char *msg);
static void setCrashLogMessage(const char *msg) {
#ifdef HAVE_CRASHREPORTERCLIENT_H
(void)CRSetCrashLogMessage(msg);
Expand Down
4 changes: 2 additions & 2 deletions llvm/lib/Target/ARM/ARMExpandPseudoInsts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,8 @@ namespace {
friend bool operator<(const NEONLdStTableEntry &TE, unsigned PseudoOpc) {
return TE.PseudoOpc < PseudoOpc;
}
friend bool LLVM_ATTRIBUTE_UNUSED operator<(unsigned PseudoOpc,
const NEONLdStTableEntry &TE) {
[[maybe_unused]] friend bool operator<(unsigned PseudoOpc,
const NEONLdStTableEntry &TE) {
return PseudoOpc < TE.PseudoOpc;
}
};
Expand Down
4 changes: 2 additions & 2 deletions llvm/lib/Target/Hexagon/HexagonBitSimplify.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,8 @@ namespace {
const TargetRegisterInfo *TRI;
};

raw_ostream &operator<< (raw_ostream &OS, const PrintRegSet &P)
LLVM_ATTRIBUTE_UNUSED;
[[maybe_unused]] raw_ostream &operator<<(raw_ostream &OS,
const PrintRegSet &P);
raw_ostream &operator<< (raw_ostream &OS, const PrintRegSet &P) {
OS << '{';
for (unsigned R = P.RS.find_first(); R; R = P.RS.find_next(R))
Expand Down
12 changes: 5 additions & 7 deletions llvm/lib/Target/Hexagon/HexagonCommonGEP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -272,15 +272,14 @@ namespace {
OS << *I << ' ' << **I << '\n';
}

raw_ostream &operator<< (raw_ostream &OS,
const NodeVect &S) LLVM_ATTRIBUTE_UNUSED;
[[maybe_unused]] raw_ostream &operator<<(raw_ostream &OS, const NodeVect &S);
raw_ostream &operator<< (raw_ostream &OS, const NodeVect &S) {
dump_node_container(OS, S);
return OS;
}

raw_ostream &operator<< (raw_ostream &OS,
const NodeToUsesMap &M) LLVM_ATTRIBUTE_UNUSED;
[[maybe_unused]] raw_ostream &operator<<(raw_ostream &OS,
const NodeToUsesMap &M);
raw_ostream &operator<< (raw_ostream &OS, const NodeToUsesMap &M){
for (const auto &I : M) {
const UseSet &Us = I.second;
Expand Down Expand Up @@ -914,9 +913,8 @@ namespace {
const NodeToValueMap &Map;
};

raw_ostream &operator<< (raw_ostream &OS,
const LocationAsBlock &Loc) LLVM_ATTRIBUTE_UNUSED ;
raw_ostream &operator<< (raw_ostream &OS, const LocationAsBlock &Loc) {
[[maybe_unused]] raw_ostream &operator<<(raw_ostream &OS,
const LocationAsBlock &Loc) {
for (const auto &I : Loc.Map) {
OS << I.first << " -> ";
if (BasicBlock *B = cast_or_null<BasicBlock>(I.second))
Expand Down
3 changes: 1 addition & 2 deletions llvm/lib/Target/Hexagon/HexagonEarlyIfConv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,7 @@ namespace {
const TargetRegisterInfo &TRI;
friend raw_ostream &operator<< (raw_ostream &OS, const PrintFP &P);
};
raw_ostream &operator<<(raw_ostream &OS,
const PrintFP &P) LLVM_ATTRIBUTE_UNUSED;
[[maybe_unused]] raw_ostream &operator<<(raw_ostream &OS, const PrintFP &P);
raw_ostream &operator<<(raw_ostream &OS, const PrintFP &P) {
OS << "{ SplitB:" << PrintMB(P.FP.SplitB)
<< ", PredR:" << printReg(P.FP.PredR, &P.TRI)
Expand Down
10 changes: 5 additions & 5 deletions llvm/lib/Target/Hexagon/HexagonGenPredicate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@ struct PrintRegister {
const TargetRegisterInfo &TRI;
};

raw_ostream &operator<< (raw_ostream &OS, const PrintRegister &PR)
LLVM_ATTRIBUTE_UNUSED;
raw_ostream &operator<< (raw_ostream &OS, const PrintRegister &PR) {
return OS << printReg(PR.Reg.Reg, &PR.TRI, PR.Reg.SubReg);
}
[[maybe_unused]] raw_ostream &operator<<(raw_ostream &OS,
const PrintRegister &PR);
raw_ostream &operator<<(raw_ostream &OS, const PrintRegister &PR) {
return OS << printReg(PR.Reg.Reg, &PR.TRI, PR.Reg.SubReg);
}

class HexagonGenPredicate : public MachineFunctionPass {
public:
Expand Down
4 changes: 2 additions & 2 deletions llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCTargetDesc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -422,12 +422,12 @@ static MCTargetStreamer *createHexagonNullTargetStreamer(MCStreamer &S) {
return new HexagonTargetStreamer(S);
}

static void LLVM_ATTRIBUTE_UNUSED clearFeature(MCSubtargetInfo* STI, uint64_t F) {
[[maybe_unused]] static void clearFeature(MCSubtargetInfo *STI, uint64_t F) {
if (STI->hasFeature(F))
STI->ToggleFeature(F);
}

static bool LLVM_ATTRIBUTE_UNUSED checkFeature(MCSubtargetInfo* STI, uint64_t F) {
[[maybe_unused]] static bool checkFeature(MCSubtargetInfo *STI, uint64_t F) {
return STI->hasFeature(F);
}

Expand Down
3 changes: 1 addition & 2 deletions llvm/lib/Target/Sparc/SparcFrameLowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -246,8 +246,7 @@ SparcFrameLowering::getFrameIndexReference(const MachineFunction &MF, int FI,
}
}

static bool LLVM_ATTRIBUTE_UNUSED verifyLeafProcRegUse(MachineRegisterInfo *MRI)
{
[[maybe_unused]] static bool verifyLeafProcRegUse(MachineRegisterInfo *MRI) {

for (unsigned reg = SP::I0; reg <= SP::I7; ++reg)
if (MRI->isPhysRegUsed(reg))
Expand Down
3 changes: 1 addition & 2 deletions llvm/lib/Target/X86/X86FloatingPoint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -602,8 +602,7 @@ namespace {
friend bool operator<(const TableEntry &TE, unsigned V) {
return TE.from < V;
}
friend bool LLVM_ATTRIBUTE_UNUSED operator<(unsigned V,
const TableEntry &TE) {
[[maybe_unused]] friend bool operator<(unsigned V, const TableEntry &TE) {
return V < TE.from;
}
};
Expand Down
4 changes: 2 additions & 2 deletions llvm/lib/TargetParser/Host.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@

using namespace llvm;

static std::unique_ptr<llvm::MemoryBuffer>
LLVM_ATTRIBUTE_UNUSED getProcCpuinfoContent() {
[[maybe_unused]] static std::unique_ptr<llvm::MemoryBuffer>
getProcCpuinfoContent() {
const char *CPUInfoFile = "/proc/cpuinfo";
if (const char *CpuinfoIntercept = std::getenv("LLVM_CPUINFO"))
CPUInfoFile = CpuinfoIntercept;
Expand Down
20 changes: 10 additions & 10 deletions llvm/lib/Transforms/Instrumentation/ControlHeightReduction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -396,9 +396,8 @@ class CHR {

} // end anonymous namespace

static inline
raw_ostream LLVM_ATTRIBUTE_UNUSED &operator<<(raw_ostream &OS,
const CHRStats &Stats) {
[[maybe_unused]] static inline raw_ostream &operator<<(raw_ostream &OS,
const CHRStats &Stats) {
Stats.print(OS);
return OS;
}
Expand All @@ -425,8 +424,8 @@ static bool shouldApply(Function &F, ProfileSummaryInfo &PSI) {
return PSI.isFunctionEntryHot(&F);
}

static void LLVM_ATTRIBUTE_UNUSED dumpIR(Function &F, const char *Label,
CHRStats *Stats) {
[[maybe_unused]] static void dumpIR(Function &F, const char *Label,
CHRStats *Stats) {
StringRef FuncName = F.getName();
StringRef ModuleName = F.getParent()->getName();
(void)(FuncName); // Unused in release build.
Expand Down Expand Up @@ -1622,7 +1621,7 @@ static void insertTrivialPHIs(CHRScope *Scope,
}

// Assert that all the CHR regions of the scope have a biased branch or select.
static void LLVM_ATTRIBUTE_UNUSED
[[maybe_unused]] static void
assertCHRRegionsHaveBiasedBranchOrSelect(CHRScope *Scope) {
#ifndef NDEBUG
auto HasBiasedBranchOrSelect = [](RegInfo &RI, CHRScope *Scope) {
Expand All @@ -1644,8 +1643,9 @@ assertCHRRegionsHaveBiasedBranchOrSelect(CHRScope *Scope) {

// Assert that all the condition values of the biased branches and selects have
// been hoisted to the pre-entry block or outside of the scope.
static void LLVM_ATTRIBUTE_UNUSED assertBranchOrSelectConditionHoisted(
CHRScope *Scope, BasicBlock *PreEntryBlock) {
[[maybe_unused]] static void
assertBranchOrSelectConditionHoisted(CHRScope *Scope,
BasicBlock *PreEntryBlock) {
CHR_DEBUG(dbgs() << "Biased regions condition values \n");
for (RegInfo &RI : Scope->CHRRegions) {
Region *R = RI.R;
Expand Down Expand Up @@ -2007,8 +2007,8 @@ void CHR::transformScopes(SmallVectorImpl<CHRScope *> &CHRScopes) {
}
}

static void LLVM_ATTRIBUTE_UNUSED
dumpScopes(SmallVectorImpl<CHRScope *> &Scopes, const char *Label) {
[[maybe_unused]] static void dumpScopes(SmallVectorImpl<CHRScope *> &Scopes,
const char *Label) {
dbgs() << Label << " " << Scopes.size() << "\n";
for (CHRScope *Scope : Scopes) {
dbgs() << *Scope << "\n";
Expand Down
3 changes: 1 addition & 2 deletions llvm/lib/Transforms/ObjCARC/ObjCARCOpts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -326,8 +326,7 @@ const unsigned BBState::OverflowOccurredValue = 0xffffffff;

namespace llvm {

raw_ostream &operator<<(raw_ostream &OS,
BBState &BBState) LLVM_ATTRIBUTE_UNUSED;
[[maybe_unused]] raw_ostream &operator<<(raw_ostream &OS, BBState &BBState);

} // end namespace llvm

Expand Down
3 changes: 1 addition & 2 deletions llvm/lib/Transforms/ObjCARC/PtrState.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ enum Sequence {
S_MovableRelease ///< objc_release(x), !clang.imprecise_release.
};

raw_ostream &operator<<(raw_ostream &OS,
const Sequence S) LLVM_ATTRIBUTE_UNUSED;
[[maybe_unused]] raw_ostream &operator<<(raw_ostream &OS, const Sequence S);

/// Unidirectional information about either a
/// retain-decrement-use-release sequence or release-use-decrement-retain
Expand Down
6 changes: 2 additions & 4 deletions llvm/lib/Transforms/Scalar/SROA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -551,12 +551,10 @@ class Slice {
}

/// Support comparison with a single offset to allow binary searches.
friend LLVM_ATTRIBUTE_UNUSED bool operator<(const Slice &LHS,
uint64_t RHSOffset) {
[[maybe_unused]] friend bool operator<(const Slice &LHS, uint64_t RHSOffset) {
return LHS.beginOffset() < RHSOffset;
}
friend LLVM_ATTRIBUTE_UNUSED bool operator<(uint64_t LHSOffset,
const Slice &RHS) {
[[maybe_unused]] friend bool operator<(uint64_t LHSOffset, const Slice &RHS) {
return LHSOffset < RHS.beginOffset();
}

Expand Down
16 changes: 8 additions & 8 deletions llvm/unittests/ADT/SmallVectorTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,24 +127,24 @@ class Constructable {
return c0.getValue() == c1.getValue();
}

friend bool LLVM_ATTRIBUTE_UNUSED operator!=(const Constructable &c0,
const Constructable &c1) {
[[maybe_unused]] friend bool operator!=(const Constructable &c0,
const Constructable &c1) {
return c0.getValue() != c1.getValue();
}

friend bool operator<(const Constructable &c0, const Constructable &c1) {
return c0.getValue() < c1.getValue();
}
friend bool LLVM_ATTRIBUTE_UNUSED operator<=(const Constructable &c0,
const Constructable &c1) {
[[maybe_unused]] friend bool operator<=(const Constructable &c0,
const Constructable &c1) {
return c0.getValue() <= c1.getValue();
}
friend bool LLVM_ATTRIBUTE_UNUSED operator>(const Constructable &c0,
const Constructable &c1) {
[[maybe_unused]] friend bool operator>(const Constructable &c0,
const Constructable &c1) {
return c0.getValue() > c1.getValue();
}
friend bool LLVM_ATTRIBUTE_UNUSED operator>=(const Constructable &c0,
const Constructable &c1) {
[[maybe_unused]] friend bool operator>=(const Constructable &c0,
const Constructable &c1) {
return c0.getValue() >= c1.getValue();
}
};
Expand Down
8 changes: 2 additions & 6 deletions llvm/utils/TableGen/Common/Types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,12 @@

#include "Types.h"

// For LLVM_ATTRIBUTE_UNUSED
#include "llvm/Support/Compiler.h"

#include <cassert>

using namespace llvm;

const char *
llvm::getMinimalTypeForRange(uint64_t Range,
unsigned MaxSize LLVM_ATTRIBUTE_UNUSED) {
const char *llvm::getMinimalTypeForRange(uint64_t Range,
[[maybe_unused]] unsigned MaxSize) {
// TODO: The original callers only used 32 and 64 so these are the only
// values permitted. Rather than widen the supported values we should
// allow 64 for the callers that currently use 32 and remove the
Expand Down