Skip to content

Commit cfdba8b

Browse files
committed
Fix some -Wconstant-conversion warnings for future Clang (D139114)
1 parent 217fd59 commit cfdba8b

File tree

3 files changed

+17
-15
lines changed

3 files changed

+17
-15
lines changed

llvm/include/llvm/Analysis/DependenceAnalysis.h

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -82,14 +82,16 @@ namespace llvm {
8282
/// has a direction (or perhaps a union of several directions), and
8383
/// perhaps a distance.
8484
struct DVEntry {
85-
enum { NONE = 0,
86-
LT = 1,
87-
EQ = 2,
88-
LE = 3,
89-
GT = 4,
90-
NE = 5,
91-
GE = 6,
92-
ALL = 7 };
85+
enum : unsigned char {
86+
NONE = 0,
87+
LT = 1,
88+
EQ = 2,
89+
LE = 3,
90+
GT = 4,
91+
NE = 5,
92+
GE = 6,
93+
ALL = 7
94+
};
9395
unsigned char Direction : 3; // Init to ALL, then refine.
9496
bool Scalar : 1; // Init to true.
9597
bool PeelFirst : 1; // Peeling the first iteration will break dependence.

llvm/lib/Analysis/DependenceAnalysis.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1379,8 +1379,8 @@ bool DependenceInfo::weakCrossingSIVtest(
13791379
LLVM_DEBUG(dbgs() << "\t Delta = " << *Delta << "\n");
13801380
NewConstraint.setLine(Coeff, Coeff, Delta, CurLoop);
13811381
if (Delta->isZero()) {
1382-
Result.DV[Level].Direction &= unsigned(~Dependence::DVEntry::LT);
1383-
Result.DV[Level].Direction &= unsigned(~Dependence::DVEntry::GT);
1382+
Result.DV[Level].Direction &= ~Dependence::DVEntry::LT;
1383+
Result.DV[Level].Direction &= ~Dependence::DVEntry::GT;
13841384
++WeakCrossingSIVsuccesses;
13851385
if (!Result.DV[Level].Direction) {
13861386
++WeakCrossingSIVindependence;
@@ -1439,8 +1439,8 @@ bool DependenceInfo::weakCrossingSIVtest(
14391439
}
14401440
if (isKnownPredicate(CmpInst::ICMP_EQ, Delta, ML)) {
14411441
// i = i' = UB
1442-
Result.DV[Level].Direction &= unsigned(~Dependence::DVEntry::LT);
1443-
Result.DV[Level].Direction &= unsigned(~Dependence::DVEntry::GT);
1442+
Result.DV[Level].Direction &= ~Dependence::DVEntry::LT;
1443+
Result.DV[Level].Direction &= ~Dependence::DVEntry::GT;
14441444
++WeakCrossingSIVsuccesses;
14451445
if (!Result.DV[Level].Direction) {
14461446
++WeakCrossingSIVindependence;
@@ -1473,7 +1473,7 @@ bool DependenceInfo::weakCrossingSIVtest(
14731473
LLVM_DEBUG(dbgs() << "\t Remainder = " << Remainder << "\n");
14741474
if (Remainder != 0) {
14751475
// Equal direction isn't possible
1476-
Result.DV[Level].Direction &= unsigned(~Dependence::DVEntry::EQ);
1476+
Result.DV[Level].Direction &= ~Dependence::DVEntry::EQ;
14771477
++WeakCrossingSIVsuccesses;
14781478
}
14791479
return false;
@@ -2557,7 +2557,7 @@ bool DependenceInfo::gcdMIVtest(const SCEV *Src, const SCEV *Dst,
25572557
LLVM_DEBUG(dbgs() << "\tRemainder = " << Remainder << "\n");
25582558
if (Remainder != 0) {
25592559
unsigned Level = mapSrcLoop(CurLoop);
2560-
Result.DV[Level - 1].Direction &= unsigned(~Dependence::DVEntry::EQ);
2560+
Result.DV[Level - 1].Direction &= ~Dependence::DVEntry::EQ;
25612561
Improved = true;
25622562
}
25632563
}

llvm/lib/Support/UnicodeNameToCodepoint.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ static Node readNode(uint32_t Offset, const Node *Parent = nullptr) {
105105
uint8_t H = UnicodeNameToCodepointIndex[Offset++];
106106
N.HasSibling = H & 0x80;
107107
bool HasChildren = H & 0x40;
108-
H &= ~uint8_t(0xC0);
108+
H &= uint8_t(~0xC0);
109109
if (HasChildren) {
110110
N.ChildrenOffset = (H << 16);
111111
N.ChildrenOffset |=

0 commit comments

Comments
 (0)