Skip to content

Commit 1baf1fc

Browse files
committed
[NFC] Remove dead code
1 parent 303b214 commit 1baf1fc

File tree

3 files changed

+6
-25
lines changed

3 files changed

+6
-25
lines changed

llvm/include/llvm/Support/Alignment.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -260,14 +260,6 @@ inline bool operator>(Align Lhs, uint64_t Rhs) {
260260
return Lhs.value() > Rhs;
261261
}
262262

263-
/// Comparisons between MaybeAlign and scalars.
264-
inline bool operator==(MaybeAlign Lhs, uint64_t Rhs) {
265-
return Lhs ? (*Lhs).value() == Rhs : Rhs == 0;
266-
}
267-
inline bool operator!=(MaybeAlign Lhs, uint64_t Rhs) {
268-
return Lhs ? (*Lhs).value() != Rhs : Rhs != 0;
269-
}
270-
271263
/// Comparisons operators between Align.
272264
inline bool operator==(Align Lhs, Align Rhs) {
273265
return Lhs.ShiftValue == Rhs.ShiftValue;

llvm/unittests/IR/AttributesTest.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,14 +90,14 @@ TEST(Attributes, RemoveAlign) {
9090
B_stackalign.addAttribute(StackAlignAttr);
9191

9292
AttributeSet AS = AttributeSet::get(C, B_align_readonly);
93-
EXPECT_TRUE(AS.getAlignment() == 8);
93+
EXPECT_TRUE(AS.getAlignment() == MaybeAlign(8));
9494
EXPECT_TRUE(AS.hasAttribute(Attribute::ReadOnly));
9595
AS = AS.removeAttribute(C, Attribute::Alignment);
9696
EXPECT_FALSE(AS.hasAttribute(Attribute::Alignment));
9797
EXPECT_TRUE(AS.hasAttribute(Attribute::ReadOnly));
9898
AS = AttributeSet::get(C, B_align_readonly);
9999
AS = AS.removeAttributes(C, B_align);
100-
EXPECT_TRUE(AS.getAlignment() == 0);
100+
EXPECT_TRUE(AS.getAlignment() == None);
101101
EXPECT_TRUE(AS.hasAttribute(Attribute::ReadOnly));
102102

103103
AttributeList AL;
@@ -106,18 +106,18 @@ TEST(Attributes, RemoveAlign) {
106106
EXPECT_TRUE(AL.hasRetAttrs());
107107
EXPECT_TRUE(AL.hasRetAttr(Attribute::StackAlignment));
108108
EXPECT_TRUE(AL.hasRetAttr(Attribute::OptimizeNone));
109-
EXPECT_TRUE(AL.getRetStackAlignment() == 32);
109+
EXPECT_TRUE(AL.getRetStackAlignment() == MaybeAlign(32));
110110
EXPECT_TRUE(AL.hasParamAttrs(0));
111111
EXPECT_TRUE(AL.hasParamAttr(0, Attribute::Alignment));
112112
EXPECT_TRUE(AL.hasParamAttr(0, Attribute::ReadOnly));
113-
EXPECT_TRUE(AL.getParamAlignment(0) == 8);
113+
EXPECT_TRUE(AL.getParamAlignment(0) == MaybeAlign(8));
114114

115115
AL = AL.removeParamAttribute(C, 0, Attribute::Alignment);
116116
EXPECT_FALSE(AL.hasParamAttr(0, Attribute::Alignment));
117117
EXPECT_TRUE(AL.hasParamAttr(0, Attribute::ReadOnly));
118118
EXPECT_TRUE(AL.hasRetAttr(Attribute::StackAlignment));
119119
EXPECT_TRUE(AL.hasRetAttr(Attribute::OptimizeNone));
120-
EXPECT_TRUE(AL.getRetStackAlignment() == 32);
120+
EXPECT_TRUE(AL.getRetStackAlignment() == MaybeAlign(32));
121121

122122
AL = AL.removeRetAttribute(C, Attribute::StackAlignment);
123123
EXPECT_FALSE(AL.hasParamAttr(0, Attribute::Alignment));
@@ -134,7 +134,7 @@ TEST(Attributes, RemoveAlign) {
134134
EXPECT_TRUE(AL2.hasParamAttr(0, Attribute::ReadOnly));
135135
EXPECT_TRUE(AL2.hasRetAttr(Attribute::StackAlignment));
136136
EXPECT_TRUE(AL2.hasRetAttr(Attribute::OptimizeNone));
137-
EXPECT_TRUE(AL2.getRetStackAlignment() == 32);
137+
EXPECT_TRUE(AL2.getRetStackAlignment() == MaybeAlign(32));
138138

139139
AL2 = AL2.removeRetAttributes(C, B_stackalign);
140140
EXPECT_FALSE(AL2.hasParamAttr(0, Attribute::Alignment));

llvm/unittests/Support/AlignmentTest.cpp

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -227,9 +227,6 @@ TEST(AlignmentTest, AlignComparisons) {
227227
EXPECT_EQ(MA, MA);
228228
EXPECT_NE(MA, MB);
229229

230-
EXPECT_EQ(MA, MA ? (*MA).value() : 0);
231-
EXPECT_NE(MA, MB ? (*MB).value() : 0);
232-
233230
EXPECT_EQ(std::max(A, B), B);
234231
EXPECT_EQ(std::min(A, B), A);
235232
}
@@ -277,14 +274,6 @@ TEST(AlignmentDeathTest, ComparisonsWithZero) {
277274
}
278275
}
279276

280-
TEST(AlignmentDeathTest, CompareMaybeAlignToZero) {
281-
for (uint64_t Value : getValidAlignmentsForDeathTest()) {
282-
// MaybeAlign is allowed to be == or != 0
283-
(void)(MaybeAlign(Value) == 0);
284-
(void)(MaybeAlign(Value) != 0);
285-
}
286-
}
287-
288277
TEST(AlignmentDeathTest, AlignAddr) {
289278
const void *const unaligned_high_ptr =
290279
reinterpret_cast<const void *>(std::numeric_limits<uintptr_t>::max() - 1);

0 commit comments

Comments
 (0)