Skip to content
Draft
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
11 changes: 6 additions & 5 deletions include/llvm/DebugInfo/DWARF/DWARFDebugAranges.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,20 +32,21 @@ class DWARFDebugAranges {
void construct();

struct Range {
explicit Range(uint64_t LowPC = -1ULL, uint64_t HighPC = -1ULL,
uint32_t CUOffset = -1U)
: LowPC(LowPC), Length(HighPC - LowPC), CUOffset(CUOffset) {}
explicit Range(uint64_t LowPC = std::numeric_limits<uint64_t>::max(),
uint64_t HighPC = std::numeric_limits<uint64_t>::max(),
uint32_t CUOffset = std::numeric_limits<uint32_t>::max())
: LowPC(LowPC), Length(HighPC - LowPC), CUOffset(CUOffset) {}

void setHighPC(uint64_t HighPC) {
if (HighPC == -1ULL || HighPC <= LowPC)
if (HighPC == std::numeric_limits<uint64_t>::max() || HighPC <= LowPC)
Length = 0;
else
Length = HighPC - LowPC;
}
uint64_t HighPC() const {
if (Length)
return LowPC + Length;
return -1ULL;
return std::numeric_limits<uint64_t>::max();
}

bool containsAddress(uint64_t Address) const {
Expand Down
5 changes: 4 additions & 1 deletion include/llvm/Support/BlockFrequency.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#define LLVM_SUPPORT_BLOCKFREQUENCY_H

#include "llvm/Support/DataTypes.h"
#include <limits>

namespace llvm {

Expand All @@ -29,7 +30,9 @@ class BlockFrequency {
BlockFrequency(uint64_t Freq = 0) : Frequency(Freq) { }

/// \brief Returns the maximum possible frequency, the saturation value.
static uint64_t getMaxFrequency() { return -1ULL; }
static uint64_t getMaxFrequency() {
return std::numeric_limits<uint64_t>::max();
}

/// \brief Returns the frequency as a fixpoint number scaled by the entry
/// frequency.
Expand Down
2 changes: 1 addition & 1 deletion lib/Analysis/LoopAccessAnalysis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1179,7 +1179,7 @@ bool MemoryDepChecker::areDepsSafe(DepCandidates &AccessSets,
MemAccessInfoSet &CheckDeps,
const ValueToValueMap &Strides) {

MaxSafeDepDistBytes = -1U;
MaxSafeDepDistBytes = std::numeric_limits<unsigned>::max();
while (!CheckDeps.empty()) {
MemAccessInfo CurAccess = *CheckDeps.begin();

Expand Down
3 changes: 2 additions & 1 deletion lib/Transforms/InstCombine/InstructionCombining.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1937,7 +1937,8 @@ Instruction *InstCombiner::visitAllocSite(Instruction &MI) {
} else if (IntrinsicInst *II = dyn_cast<IntrinsicInst>(I)) {
if (II->getIntrinsicID() == Intrinsic::objectsize) {
ConstantInt *CI = cast<ConstantInt>(II->getArgOperand(1));
uint64_t DontKnow = CI->isZero() ? -1ULL : 0;
uint64_t DontKnow =
CI->isZero() ? std::numeric_limits<uint64_t>::max() : 0;
ReplaceInstUsesWith(*I, ConstantInt::get(I->getType(), DontKnow));
}
}
Expand Down
4 changes: 2 additions & 2 deletions lib/Transforms/Scalar/LoadCombine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,10 @@ bool LoadCombine::aggregateLoads(SmallVectorImpl<LoadPOPPair> &Loads) {
LoadInst *BaseLoad = nullptr;
SmallVector<LoadPOPPair, 8> AggregateLoads;
bool Combined = false;
uint64_t PrevOffset = -1ull;
uint64_t PrevOffset = std::numeric_limits<uint64_t>::max();
uint64_t PrevSize = 0;
for (auto &L : Loads) {
if (PrevOffset == -1ull) {
if (PrevOffset == std::numeric_limits<uint64_t>::max()) {
BaseLoad = L.Load;
PrevOffset = L.POP.Offset;
PrevSize = L.Load->getModule()->getDataLayout().getTypeStoreSize(
Expand Down
4 changes: 3 additions & 1 deletion tools/clang/include/clang/AST/Expr.h
Original file line number Diff line number Diff line change
Expand Up @@ -4510,7 +4510,9 @@ class GenericSelectionExpr : public Expr {
Expr *getControllingExpr() { return cast<Expr>(SubExprs[CONTROLLING]); }

/// Whether this generic selection is result-dependent.
bool isResultDependent() const { return ResultIndex == -1U; }
bool isResultDependent() const {
return ResultIndex == std::numeric_limits<unsigned>::max();
}

/// The zero-based index of the result expression's generic association in
/// the generic selection's association list. Defined only if the
Expand Down
34 changes: 15 additions & 19 deletions tools/clang/lib/AST/Expr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3886,25 +3886,21 @@ GenericSelectionExpr::GenericSelectionExpr(const ASTContext &Context,
std::copy(AssocExprs.begin(), AssocExprs.end(), SubExprs+END_EXPR);
}

GenericSelectionExpr::GenericSelectionExpr(const ASTContext &Context,
SourceLocation GenericLoc, Expr *ControllingExpr,
ArrayRef<TypeSourceInfo*> AssocTypes,
ArrayRef<Expr*> AssocExprs,
SourceLocation DefaultLoc,
SourceLocation RParenLoc,
bool ContainsUnexpandedParameterPack)
: Expr(GenericSelectionExprClass,
Context.DependentTy,
VK_RValue,
OK_Ordinary,
/*isTypeDependent=*/true,
/*isValueDependent=*/true,
/*isInstantiationDependent=*/true,
ContainsUnexpandedParameterPack),
AssocTypes(new (Context) TypeSourceInfo*[AssocTypes.size()]),
SubExprs(new (Context) Stmt*[END_EXPR+AssocExprs.size()]),
NumAssocs(AssocExprs.size()), ResultIndex(-1U), GenericLoc(GenericLoc),
DefaultLoc(DefaultLoc), RParenLoc(RParenLoc) {
GenericSelectionExpr::GenericSelectionExpr(
const ASTContext &Context, SourceLocation GenericLoc, Expr *ControllingExpr,
ArrayRef<TypeSourceInfo *> AssocTypes, ArrayRef<Expr *> AssocExprs,
SourceLocation DefaultLoc, SourceLocation RParenLoc,
bool ContainsUnexpandedParameterPack)
: Expr(GenericSelectionExprClass, Context.DependentTy, VK_RValue,
OK_Ordinary,
/*isTypeDependent=*/true,
/*isValueDependent=*/true,
/*isInstantiationDependent=*/true, ContainsUnexpandedParameterPack),
AssocTypes(new(Context) TypeSourceInfo *[AssocTypes.size()]),
SubExprs(new(Context) Stmt *[END_EXPR + AssocExprs.size()]),
NumAssocs(AssocExprs.size()),
ResultIndex(std::numeric_limits<unsigned>::max()), GenericLoc(GenericLoc),
DefaultLoc(DefaultLoc), RParenLoc(RParenLoc) {
SubExprs[CONTROLLING] = ControllingExpr;
assert(AssocTypes.size() == AssocExprs.size());
std::copy(AssocTypes.begin(), AssocTypes.end(), this->AssocTypes);
Expand Down
3 changes: 2 additions & 1 deletion tools/clang/lib/CodeGen/CGExprScalar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2559,7 +2559,8 @@ void ScalarExprEmitter::EmitUndefinedBehaviorIntegerDivAndRemCheck(

llvm::Value *IntMin =
Builder.getInt(llvm::APInt::getSignedMinValue(Ty->getBitWidth()));
llvm::Value *NegOne = llvm::ConstantInt::get(Ty, -1ULL);
llvm::Value *NegOne =
llvm::ConstantInt::get(Ty, std::numeric_limits<uint64_t>::max());

llvm::Value *LHSCmp = Builder.CreateICmpNE(Ops.LHS, IntMin);
llvm::Value *RHSCmp = Builder.CreateICmpNE(Ops.RHS, NegOne);
Expand Down
2 changes: 1 addition & 1 deletion tools/clang/lib/Lex/Lexer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2737,7 +2737,7 @@ uint32_t Lexer::tryReadUCN(const char *&StartPtr, const char *SlashLoc,
char C = getCharAndSize(CurPtr, CharSize);

unsigned Value = llvm::hexDigitValue(C);
if (Value == -1U) {
if (Value == std::numeric_limits<unsigned>::max()) {
if (Result && !isLexingRawMode()) {
if (i == 0) {
Diag(BufferPtr, diag::warn_ucn_escape_no_digits)
Expand Down
5 changes: 3 additions & 2 deletions tools/clang/lib/Sema/SemaExpr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1466,7 +1466,7 @@ Sema::CreateGenericSelectionExpr(SourceLocation KeyLoc,
ContainsUnexpandedParameterPack);

SmallVector<unsigned, 1> CompatIndices;
unsigned DefaultIndex = -1U;
unsigned DefaultIndex = std::numeric_limits<unsigned>::max();
for (unsigned i = 0; i < NumAssocs; ++i) {
if (!Types[i])
DefaultIndex = i;
Expand Down Expand Up @@ -1498,7 +1498,8 @@ Sema::CreateGenericSelectionExpr(SourceLocation KeyLoc,
// C11 6.5.1.1p2 "If a generic selection has no default generic association,
// its controlling expression shall have type compatible with exactly one of
// the types named in its generic association list."
if (DefaultIndex == -1U && CompatIndices.size() == 0) {
if (DefaultIndex == std::numeric_limits<unsigned>::max() &&
CompatIndices.size() == 0) {
// We strip parens here because the controlling expression is typically
// parenthesized in macro definitions.
ControllingExpr = ControllingExpr->IgnoreParens();
Expand Down
4 changes: 2 additions & 2 deletions tools/clang/lib/Sema/SemaType.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ distributeObjCPointerTypeAttrFromDeclarator(TypeProcessingState &state,

// objc_gc goes on the innermost pointer to something that's not a
// pointer.
unsigned innermost = -1U;
unsigned innermost = std::numeric_limits<unsigned>::max();
bool considerDeclSpec = true;
for (unsigned i = 0, e = declarator.getNumTypeObjects(); i != e; ++i) {
DeclaratorChunk &chunk = declarator.getTypeObject(i);
Expand Down Expand Up @@ -501,7 +501,7 @@ distributeObjCPointerTypeAttrFromDeclarator(TypeProcessingState &state,

// Otherwise, if we found an appropriate chunk, splice the attribute
// into it.
if (innermost != -1U) {
if (innermost != std::numeric_limits<unsigned>::max()) {
moveAttrFromListToList(attr, declarator.getAttrListRef(),
declarator.getTypeObject(innermost).getAttrListRef());
return;
Expand Down
9 changes: 5 additions & 4 deletions utils/TableGen/FixedLenDecoderEmitter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -547,10 +547,11 @@ void Filter::recurse() {

// Delegates to an inferior filter chooser for further processing on this
// group of instructions whose segment values are variable.
FilterChooserMap.insert(
std::make_pair(-1U, llvm::make_unique<FilterChooser>(
Owner->AllInstructions, VariableInstructions,
Owner->Operands, BitValueArray, *Owner)));
FilterChooserMap.insert(std::make_pair(
std::numeric_limits<unsigned>::max(),
llvm::make_unique<FilterChooser>(Owner->AllInstructions,
VariableInstructions, Owner->Operands,
BitValueArray, *Owner)));
}

// No need to recurse for a singleton filtered instruction.
Expand Down
Loading