<div dir="ltr"><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Jul 16, 2020 at 2:32 AM Kaylor, Andrew <<a href="mailto:andrew.kaylor@intel.com">andrew.kaylor@intel.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi Nikita,<br>
<br>
This change broke some of our builds, which are still using Visual Studio 2017. While it appears not to have caused problems for buildbots, that doesn't mean there are no users of LLVM who are building with VS2017 and werror.<br>
<br>
Can you work around the problem in a different way?<br>
<br>
Thanks,<br>
Andy<br></blockquote><div><br></div><div>Sure! I've applied <a href="https://github.com/llvm/llvm-project/commit/f7dce88915ad1629df2d19cd41e45a5e64f2664c">https://github.com/llvm/llvm-project/commit/f7dce88915ad1629df2d19cd41e45a5e64f2664c</a> to hopefully avoid the warning, but don't have MSVC to test it myself. Please tell me if the issue persists.</div><div><br></div><div>Regards,<br></div><div>Nikita<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
-----Original Message-----<br>
From: llvm-commits <<a href="mailto:llvm-commits-bounces@lists.llvm.org" target="_blank">llvm-commits-bounces@lists.llvm.org</a>> On Behalf Of Nikita Popov via llvm-commits<br>
Sent: Tuesday, June 23, 2020 1:34 PM<br>
To: <a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a><br>
Subject: [llvm] 6904c71 - [IR] Remove MSVC warning workaround (NFC)<br>
<br>
<br>
Author: Nikita Popov<br>
Date: 2020-06-23T22:33:57+02:00<br>
New Revision: 6904c7129b26373eb33489b43538ab580829655e<br>
<br>
URL: <a href="https://github.com/llvm/llvm-project/commit/6904c7129b26373eb33489b43538ab580829655e" rel="noreferrer" target="_blank">https://github.com/llvm/llvm-project/commit/6904c7129b26373eb33489b43538ab580829655e</a><br>
DIFF: <a href="https://github.com/llvm/llvm-project/commit/6904c7129b26373eb33489b43538ab580829655e.diff" rel="noreferrer" target="_blank">https://github.com/llvm/llvm-project/commit/6904c7129b26373eb33489b43538ab580829655e.diff</a><br>
<br>
LOG: [IR] Remove MSVC warning workaround (NFC)<br>
<br>
While LLVM does fold this to x+1, GCC does not. As this is hot code, let's try to avoid that.<br>
<br>
According to<br>
<a href="https://developercommunity.visualstudio.com/content/problem/211134/unsigned-integer-overflows-in-constexpr-functionsa.html" rel="noreferrer" target="_blank">https://developercommunity.visualstudio.com/content/problem/211134/unsigned-integer-overflows-in-constexpr-functionsa.html</a><br>
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...<br>
<br>
Added: <br>
<br>
<br>
Modified: <br>
    llvm/lib/IR/Attributes.cpp<br>
<br>
Removed: <br>
<br>
<br>
<br>
################################################################################<br>
diff  --git a/llvm/lib/IR/Attributes.cpp b/llvm/lib/IR/Attributes.cpp index d8798eb12ae7..8bdd67907106 100644<br>
--- a/llvm/lib/IR/Attributes.cpp<br>
+++ b/llvm/lib/IR/Attributes.cpp<br>
@@ -965,11 +965,9 @@ std::string AttributeSetNode::getAsString(bool InAttrGrp) const {  //===----------------------------------------------------------------------===//<br>
<br>
 /// 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.<br>
+/// to work, because -1 wraps around to 0.<br>
 static constexpr unsigned attrIdxToArrayIdx(unsigned Index) {<br>
-  return Index == AttributeList::FunctionIndex ? 0 : Index + 1;<br>
+  return Index + 1;<br>
 }<br>
<br>
 AttributeListImpl::AttributeListImpl(ArrayRef<AttributeSet> Sets)<br>
<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
</blockquote></div></div>