[llvm] d558336 - [FunctionComparator] Use getAlign() instead of getAlignment()
Arthur Eubanks via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 15 14:41:11 PST 2021
Author: Arthur Eubanks
Date: 2021-12-15T14:40:56-08:00
New Revision: d5583366baa734e2d59946743086e0aec7cae431
URL: https://github.com/llvm/llvm-project/commit/d5583366baa734e2d59946743086e0aec7cae431
DIFF: https://github.com/llvm/llvm-project/commit/d5583366baa734e2d59946743086e0aec7cae431.diff
LOG: [FunctionComparator] Use getAlign() instead of getAlignment()
getAlignment() is deprecated.
Added:
Modified:
llvm/include/llvm/Transforms/Utils/FunctionComparator.h
llvm/lib/Transforms/Utils/FunctionComparator.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/Transforms/Utils/FunctionComparator.h b/llvm/include/llvm/Transforms/Utils/FunctionComparator.h
index e808a50b320fb..964fdce45744c 100644
--- a/llvm/include/llvm/Transforms/Utils/FunctionComparator.h
+++ b/llvm/include/llvm/Transforms/Utils/FunctionComparator.h
@@ -320,6 +320,7 @@ class FunctionComparator {
int cmpTypes(Type *TyL, Type *TyR) const;
int cmpNumbers(uint64_t L, uint64_t R) const;
+ int cmpAligns(Align L, Align R) const;
int cmpAPInts(const APInt &L, const APInt &R) const;
int cmpAPFloats(const APFloat &L, const APFloat &R) const;
int cmpMem(StringRef L, StringRef R) const;
diff --git a/llvm/lib/Transforms/Utils/FunctionComparator.cpp b/llvm/lib/Transforms/Utils/FunctionComparator.cpp
index 326864803d7c2..06596f7b04e17 100644
--- a/llvm/lib/Transforms/Utils/FunctionComparator.cpp
+++ b/llvm/lib/Transforms/Utils/FunctionComparator.cpp
@@ -58,6 +58,14 @@ int FunctionComparator::cmpNumbers(uint64_t L, uint64_t R) const {
return 0;
}
+int FunctionComparator::cmpAligns(Align L, Align R) const {
+ if (L.value() < R.value())
+ return -1;
+ if (L.value() > R.value())
+ return 1;
+ return 0;
+}
+
int FunctionComparator::cmpOrderings(AtomicOrdering L, AtomicOrdering R) const {
if ((int)L < (int)R)
return -1;
@@ -556,13 +564,12 @@ int FunctionComparator::cmpOperations(const Instruction *L,
if (int Res = cmpTypes(AI->getAllocatedType(),
cast<AllocaInst>(R)->getAllocatedType()))
return Res;
- return cmpNumbers(AI->getAlignment(), cast<AllocaInst>(R)->getAlignment());
+ return cmpAligns(AI->getAlign(), cast<AllocaInst>(R)->getAlign());
}
if (const LoadInst *LI = dyn_cast<LoadInst>(L)) {
if (int Res = cmpNumbers(LI->isVolatile(), cast<LoadInst>(R)->isVolatile()))
return Res;
- if (int Res =
- cmpNumbers(LI->getAlignment(), cast<LoadInst>(R)->getAlignment()))
+ if (int Res = cmpAligns(LI->getAlign(), cast<LoadInst>(R)->getAlign()))
return Res;
if (int Res =
cmpOrderings(LI->getOrdering(), cast<LoadInst>(R)->getOrdering()))
@@ -578,8 +585,7 @@ int FunctionComparator::cmpOperations(const Instruction *L,
if (int Res =
cmpNumbers(SI->isVolatile(), cast<StoreInst>(R)->isVolatile()))
return Res;
- if (int Res =
- cmpNumbers(SI->getAlignment(), cast<StoreInst>(R)->getAlignment()))
+ if (int Res = cmpAligns(SI->getAlign(), cast<StoreInst>(R)->getAlign()))
return Res;
if (int Res =
cmpOrderings(SI->getOrdering(), cast<StoreInst>(R)->getOrdering()))
More information about the llvm-commits
mailing list