forked from OSchip/llvm-project
[IR] Remove MSVC warning workaround (NFC)
While LLVM does fold this to x+1, GCC does not. As this is hot code, let's try to avoid that. According to https://developercommunity.visualstudio.com/content/problem/211134/unsigned-integer-overflows-in-constexpr-functionsa.html this spurious warning in MSVC has been fixed in Visual Studio 2019 Version 16.4. Let's see if there are any build bots running old MSVC versions with warnings treated as errors...
This commit is contained in:
parent
e6d8636935
commit
6904c7129b
|
@ -965,11 +965,9 @@ std::string AttributeSetNode::getAsString(bool InAttrGrp) const {
|
|||
//===----------------------------------------------------------------------===//
|
||||
|
||||
/// Map from AttributeList index to the internal array index. Adding one happens
|
||||
/// to work, but it relies on unsigned integer wrapping. MSVC warns about
|
||||
/// unsigned wrapping in constexpr functions, so write out the conditional. LLVM
|
||||
/// folds it to add anyway.
|
||||
/// to work, because -1 wraps around to 0.
|
||||
static constexpr unsigned attrIdxToArrayIdx(unsigned Index) {
|
||||
return Index == AttributeList::FunctionIndex ? 0 : Index + 1;
|
||||
return Index + 1;
|
||||
}
|
||||
|
||||
AttributeListImpl::AttributeListImpl(ArrayRef<AttributeSet> Sets)
|
||||
|
|
Loading…
Reference in New Issue