<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Oct 27, 2015 at 9:53 PM, Craig Topper via llvm-commits <span dir="ltr"><<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: ctopper<br>
Date: Tue Oct 27 23:53:27 2015<br>
New Revision: 251494<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=251494&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=251494&view=rev</a><br>
Log:<br>
Use range-based for loops and use initializer list to remove a small static array. NFC<br></blockquote><div><br></div><div>This ends up duplicating the sequence (so changes to the sequence could become inconsistent, etc) - would it be best to keep the sequence defined once, while still migrating to range-based-for?</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Modified:<br>
    llvm/trunk/lib/Target/X86/X86ISelLowering.cpp<br>
<br>
Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=251494&r1=251493&r2=251494&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=251494&r1=251493&r2=251494&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)<br>
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Tue Oct 27 23:53:27 2015<br>
@@ -75,7 +75,6 @@ X86TargetLowering::X86TargetLowering(con<br>
   MVT PtrVT = MVT::getIntegerVT(8 * TM.getPointerSize());<br>
<br>
   // Set up the TargetLowering object.<br>
-  static const MVT IntVTs[] = { MVT::i8, MVT::i16, MVT::i32, MVT::i64 };<br>
<br>
   // X86 is weird. It always uses i8 for shift amounts and setcc results.<br>
   setBooleanContents(ZeroOrOneBooleanContent);<br>
@@ -270,8 +269,7 @@ X86TargetLowering::X86TargetLowering(con<br>
   // (low) operations are left as Legal, as there are single-result<br>
   // instructions for this in x86. Using the two-result multiply instructions<br>
   // when both high and low results are needed must be arranged by dagcombine.<br>
-  for (unsigned i = 0; i != array_lengthof(IntVTs); ++i) {<br>
-    MVT VT = IntVTs[i];<br>
+  for (auto VT : { MVT::i8, MVT::i16, MVT::i32, MVT::i64 }) {<br>
     setOperationAction(ISD::MULHS, VT, Expand);<br>
     setOperationAction(ISD::MULHU, VT, Expand);<br>
     setOperationAction(ISD::SDIV, VT, Expand);<br>
@@ -462,8 +460,7 @@ X86TargetLowering::X86TargetLowering(con<br>
   setOperationAction(ISD::ATOMIC_FENCE  , MVT::Other, Custom);<br>
<br>
   // Expand certain atomics<br>
-  for (unsigned i = 0; i != array_lengthof(IntVTs); ++i) {<br>
-    MVT VT = IntVTs[i];<br>
+  for (auto VT : { MVT::i8, MVT::i16, MVT::i32, MVT::i64 }) {<br>
     setOperationAction(ISD::ATOMIC_CMP_SWAP_WITH_SUCCESS, VT, Custom);<br>
     setOperationAction(ISD::ATOMIC_LOAD_SUB, VT, Custom);<br>
     setOperationAction(ISD::ATOMIC_STORE, VT, Custom);<br>
@@ -1753,9 +1750,10 @@ X86TargetLowering::X86TargetLowering(con<br>
   // FIXME: We really should do custom legalization for addition and<br>
   // subtraction on x86-32 once PR3203 is fixed.  We really can't do much better<br>
   // than generic legalization for 64-bit multiplication-with-overflow, though.<br>
-  for (unsigned i = 0, e = 3+Subtarget->is64Bit(); i != e; ++i) {<br>
+  for (auto VT : { MVT::i8, MVT::i16, MVT::i32, MVT::i64 }) {<br>
+    if (VT == MVT::i64 && !Subtarget->is64Bit())<br>
+      continue;<br>
     // Add/Sub/Mul with overflow operations are custom lowered.<br>
-    MVT VT = IntVTs[i];<br>
     setOperationAction(ISD::SADDO, VT, Custom);<br>
     setOperationAction(ISD::UADDO, VT, Custom);<br>
     setOperationAction(ISD::SSUBO, VT, Custom);<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br></div></div>