Skip to content

Commit b1bf95c

Browse files
authored
ReduxWidth check for 0 (llvm#123257)
Added assert to check for underflow of ReduxWidth modified: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp Source code analysis flagged the operation (ReduxWwidth - 1) as potential underflow, since ReduxWidth is unsigned. Realize that this should never happen if everything is working right, but added an assert to check for it just in case.
1 parent e5a28a3 commit b1bf95c

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20095,6 +20095,7 @@ class HorizontalReduction {
2009520095
NumRegs =
2009620096
TTI.getNumberOfRegisters(TTI.getRegisterClassForType(true, Tp));
2009720097
while (NumParts > NumRegs) {
20098+
assert(ReduxWidth > 0 && "ReduxWidth is unexpectedly 0.");
2009820099
ReduxWidth = bit_floor(ReduxWidth - 1);
2009920100
VectorType *Tp = getWidenedType(ScalarTy, ReduxWidth);
2010020101
NumParts = TTI.getNumberOfParts(Tp);

0 commit comments

Comments
 (0)