Skip to content

Commit 15c8ba4

Browse files
committed
Revert "[Support] Refactor getN1Bits so it does not work around any g++ bug (llvm#78933)"
This reverts commit bb02bf7. PR merged without review.
1 parent 83370e4 commit 15c8ba4

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

llvm/include/llvm/Support/Discriminator.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,12 @@ static inline unsigned getBaseFSBitEnd() {
121121
}
122122

123123
// Set bits in range of [0 .. n] to 1. Used in FS Discriminators.
124-
static inline unsigned getN1Bits(unsigned N) {
124+
static inline unsigned getN1Bits(int N) {
125+
// Work around the g++ bug that folding "(1U << (N + 1)) - 1" to 0.
126+
if (N == 31)
127+
return 0xFFFFFFFF;
125128
assert((N < 32) && "N is invalid");
126-
return 0xFFFFFFFF >> (31 - N);
129+
return (1U << (N + 1)) - 1;
127130
}
128131

129132
} // namespace llvm

0 commit comments

Comments
 (0)