[llvm] 6dc6f43 - [Alignment][NFC] Use Align within StringTableBuilder
Guillaume Chatelet via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 2 04:10:36 PST 2022
Author: Guillaume Chatelet
Date: 2022-12-02T12:10:24Z
New Revision: 6dc6f436cbf4a3e6c123cf801f02927ae406c1e6
URL: https://github.com/llvm/llvm-project/commit/6dc6f436cbf4a3e6c123cf801f02927ae406c1e6
DIFF: https://github.com/llvm/llvm-project/commit/6dc6f436cbf4a3e6c123cf801f02927ae406c1e6.diff
LOG: [Alignment][NFC] Use Align within StringTableBuilder
Added:
Modified:
llvm/include/llvm/MC/StringTableBuilder.h
llvm/lib/MC/StringTableBuilder.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/MC/StringTableBuilder.h b/llvm/include/llvm/MC/StringTableBuilder.h
index 42133f3f77265..5e12e2d527344 100644
--- a/llvm/include/llvm/MC/StringTableBuilder.h
+++ b/llvm/include/llvm/MC/StringTableBuilder.h
@@ -12,6 +12,7 @@
#include "llvm/ADT/CachedHashString.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Alignment.h"
#include <cstddef>
#include <cstdint>
@@ -38,7 +39,7 @@ class StringTableBuilder {
DenseMap<CachedHashStringRef, size_t> StringIndexMap;
size_t Size = 0;
Kind K;
- unsigned Alignment;
+ Align Alignment;
bool Finalized = false;
void finalizeStringTable(bool Optimize);
diff --git a/llvm/lib/MC/StringTableBuilder.cpp b/llvm/lib/MC/StringTableBuilder.cpp
index ec0f93d22e34c..f78460edafabc 100644
--- a/llvm/lib/MC/StringTableBuilder.cpp
+++ b/llvm/lib/MC/StringTableBuilder.cpp
@@ -151,7 +151,7 @@ void StringTableBuilder::finalizeStringTable(bool Optimize) {
StringRef S = P->first.val();
if (Previous.endswith(S)) {
size_t Pos = Size - S.size() - (K != RAW);
- if (!(Pos & (Alignment - 1))) {
+ if (isAligned(Alignment, Pos)) {
P->second = Pos;
continue;
}
More information about the llvm-commits
mailing list