[llvm] 17e6815 - [NFC][Alignment] Remove dead code
Guillaume Chatelet via llvm-commits
llvm-commits at lists.llvm.org
Sat Jun 18 08:01:12 PDT 2022
Author: Guillaume Chatelet
Date: 2022-06-18T15:00:55Z
New Revision: 17e68156f644906207eed23fda3998065123f47a
URL: https://github.com/llvm/llvm-project/commit/17e68156f644906207eed23fda3998065123f47a
DIFF: https://github.com/llvm/llvm-project/commit/17e68156f644906207eed23fda3998065123f47a.diff
LOG: [NFC][Alignment] Remove dead code
Added:
Modified:
llvm/include/llvm/Support/Alignment.h
llvm/unittests/Support/AlignmentTest.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/Support/Alignment.h b/llvm/include/llvm/Support/Alignment.h
index 1176c026ba994..c4d00ed6de6ee 100644
--- a/llvm/include/llvm/Support/Alignment.h
+++ b/llvm/include/llvm/Support/Alignment.h
@@ -331,12 +331,6 @@ inline Align operator/(Align Lhs, uint64_t Divisor) {
return Align(Lhs.value() / Divisor);
}
-inline MaybeAlign operator/(MaybeAlign Lhs, uint64_t Divisor) {
- assert(llvm::isPowerOf2_64(Divisor) &&
- "Divisor must be positive and a power of 2");
- return Lhs ? Lhs.getValue() / Divisor : MaybeAlign();
-}
-
inline Align max(MaybeAlign Lhs, Align Rhs) {
return Lhs && *Lhs > Rhs ? *Lhs : Rhs;
}
diff --git a/llvm/unittests/Support/AlignmentTest.cpp b/llvm/unittests/Support/AlignmentTest.cpp
index 5ef9cd4b2ac78..be95f584d7b16 100644
--- a/llvm/unittests/Support/AlignmentTest.cpp
+++ b/llvm/unittests/Support/AlignmentTest.cpp
@@ -78,10 +78,8 @@ TEST(AlignmentTest, Division) {
for (uint64_t Value : getValidAlignments()) {
if (Value > 1) {
EXPECT_EQ(Align(Value) / 2, Value / 2);
- EXPECT_EQ(MaybeAlign(Value) / 2, Value / 2);
}
}
- EXPECT_EQ(MaybeAlign(0) / 2, MaybeAlign(0));
}
TEST(AlignmentTest, AlignTo) {
@@ -317,7 +315,6 @@ TEST(AlignmentDeathTest, CantConvertUnsetMaybe) {
TEST(AlignmentDeathTest, Division) {
EXPECT_DEATH(Align(1) / 2, "Can't halve byte alignment");
- EXPECT_DEATH(MaybeAlign(1) / 2, "Can't halve byte alignment");
EXPECT_DEATH(Align(8) / 0, "Divisor must be positive and a power of 2");
EXPECT_DEATH(Align(8) / 3, "Divisor must be positive and a power of 2");
More information about the llvm-commits
mailing list