[llvm] cfdba8b - Fix some -Wconstant-conversion warnings for future Clang (D139114)
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 13 16:28:49 PST 2023
Author: Fangrui Song
Date: 2023-01-13T16:28:44-08:00
New Revision: cfdba8b7400746250daf9f9557d3dfca3dadf7c6
URL: https://github.com/llvm/llvm-project/commit/cfdba8b7400746250daf9f9557d3dfca3dadf7c6
DIFF: https://github.com/llvm/llvm-project/commit/cfdba8b7400746250daf9f9557d3dfca3dadf7c6.diff
LOG: Fix some -Wconstant-conversion warnings for future Clang (D139114)
Added:
Modified:
llvm/include/llvm/Analysis/DependenceAnalysis.h
llvm/lib/Analysis/DependenceAnalysis.cpp
llvm/lib/Support/UnicodeNameToCodepoint.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/Analysis/DependenceAnalysis.h b/llvm/include/llvm/Analysis/DependenceAnalysis.h
index 0ea315af75036..327315f831e11 100644
--- a/llvm/include/llvm/Analysis/DependenceAnalysis.h
+++ b/llvm/include/llvm/Analysis/DependenceAnalysis.h
@@ -82,14 +82,16 @@ namespace llvm {
/// has a direction (or perhaps a union of several directions), and
/// perhaps a distance.
struct DVEntry {
- enum { NONE = 0,
- LT = 1,
- EQ = 2,
- LE = 3,
- GT = 4,
- NE = 5,
- GE = 6,
- ALL = 7 };
+ enum : unsigned char {
+ NONE = 0,
+ LT = 1,
+ EQ = 2,
+ LE = 3,
+ GT = 4,
+ NE = 5,
+ GE = 6,
+ ALL = 7
+ };
unsigned char Direction : 3; // Init to ALL, then refine.
bool Scalar : 1; // Init to true.
bool PeelFirst : 1; // Peeling the first iteration will break dependence.
diff --git a/llvm/lib/Analysis/DependenceAnalysis.cpp b/llvm/lib/Analysis/DependenceAnalysis.cpp
index 92d29a5525651..1bce9aae09bb2 100644
--- a/llvm/lib/Analysis/DependenceAnalysis.cpp
+++ b/llvm/lib/Analysis/DependenceAnalysis.cpp
@@ -1379,8 +1379,8 @@ bool DependenceInfo::weakCrossingSIVtest(
LLVM_DEBUG(dbgs() << "\t Delta = " << *Delta << "\n");
NewConstraint.setLine(Coeff, Coeff, Delta, CurLoop);
if (Delta->isZero()) {
- Result.DV[Level].Direction &= unsigned(~Dependence::DVEntry::LT);
- Result.DV[Level].Direction &= unsigned(~Dependence::DVEntry::GT);
+ Result.DV[Level].Direction &= ~Dependence::DVEntry::LT;
+ Result.DV[Level].Direction &= ~Dependence::DVEntry::GT;
++WeakCrossingSIVsuccesses;
if (!Result.DV[Level].Direction) {
++WeakCrossingSIVindependence;
@@ -1439,8 +1439,8 @@ bool DependenceInfo::weakCrossingSIVtest(
}
if (isKnownPredicate(CmpInst::ICMP_EQ, Delta, ML)) {
// i = i' = UB
- Result.DV[Level].Direction &= unsigned(~Dependence::DVEntry::LT);
- Result.DV[Level].Direction &= unsigned(~Dependence::DVEntry::GT);
+ Result.DV[Level].Direction &= ~Dependence::DVEntry::LT;
+ Result.DV[Level].Direction &= ~Dependence::DVEntry::GT;
++WeakCrossingSIVsuccesses;
if (!Result.DV[Level].Direction) {
++WeakCrossingSIVindependence;
@@ -1473,7 +1473,7 @@ bool DependenceInfo::weakCrossingSIVtest(
LLVM_DEBUG(dbgs() << "\t Remainder = " << Remainder << "\n");
if (Remainder != 0) {
// Equal direction isn't possible
- Result.DV[Level].Direction &= unsigned(~Dependence::DVEntry::EQ);
+ Result.DV[Level].Direction &= ~Dependence::DVEntry::EQ;
++WeakCrossingSIVsuccesses;
}
return false;
@@ -2557,7 +2557,7 @@ bool DependenceInfo::gcdMIVtest(const SCEV *Src, const SCEV *Dst,
LLVM_DEBUG(dbgs() << "\tRemainder = " << Remainder << "\n");
if (Remainder != 0) {
unsigned Level = mapSrcLoop(CurLoop);
- Result.DV[Level - 1].Direction &= unsigned(~Dependence::DVEntry::EQ);
+ Result.DV[Level - 1].Direction &= ~Dependence::DVEntry::EQ;
Improved = true;
}
}
diff --git a/llvm/lib/Support/UnicodeNameToCodepoint.cpp b/llvm/lib/Support/UnicodeNameToCodepoint.cpp
index df71be3ca2871..accebf1098ab7 100644
--- a/llvm/lib/Support/UnicodeNameToCodepoint.cpp
+++ b/llvm/lib/Support/UnicodeNameToCodepoint.cpp
@@ -105,7 +105,7 @@ static Node readNode(uint32_t Offset, const Node *Parent = nullptr) {
uint8_t H = UnicodeNameToCodepointIndex[Offset++];
N.HasSibling = H & 0x80;
bool HasChildren = H & 0x40;
- H &= ~uint8_t(0xC0);
+ H &= uint8_t(~0xC0);
if (HasChildren) {
N.ChildrenOffset = (H << 16);
N.ChildrenOffset |=
More information about the llvm-commits
mailing list