<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Jul 25, 2015 at 9:57 AM, Pete Cooper <span dir="ltr"><<a href="mailto:peter_cooper@apple.com" target="_blank">peter_cooper@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><br><div><span class=""><blockquote type="cite"><div>On Jul 25, 2015, at 9:20 AM, Craig Topper <<a href="mailto:craig.topper@gmail.com" target="_blank">craig.topper@gmail.com</a>> wrote:</div><br><div><div dir="ltr">I thought we prefered not to put const on Types.</div></div></blockquote></span></div></div></blockquote><div>Yep, that's correct - in fact one of my first contributions to the project was to provide patches to make that transition after the great 3.0 type system rewrite Chris did.<br><br><a href="http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20110711/124192.html">http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20110711/124192.html</a><br><br>I can't seem to find the actual commit(s) that applied the main changes there - maybe it never made it to the mailing list because it was too big. </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div><span class=""><blockquote type="cite"><div><div dir="ltr"> </div></div></blockquote></span>I didn’t know that.  Thanks for the tip.  </div><div><br></div><div>I did a quick search of LLVM and there’s 44 hits for ‘const Type *’.  I’m sure if I searched without the const there would be 1000’s of hits so looks like we’re reasonably consistent about leaving out the const.  I’ll revert this when i’m next at a recent checkout to do so.<span class=""><br><blockquote type="cite"><div><div dir="ltr">They don't have any non-const methods anyway do they?</div></div></blockquote></span>Only one (PointerType *getPointerTo(unsigned AddrSpace = 0);) and I don’t think it needs to be non-const.  I’ll also see if i can fix that.  I think its only non-const because PointerType::get takes a non-const Type*.</div><div><br></div><div>Cheers,</div><div>Pete<br><blockquote type="cite"><div><div class="gmail_extra"><br><div class="gmail_quote"><span class="">On Fri, Jul 24, 2015 at 12:19 PM, Pete Cooper <span dir="ltr"><<a href="mailto:peter_cooper@apple.com" target="_blank">peter_cooper@apple.com</a>></span> wrote:<br></span><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">Author: pete<br>
Date: Fri Jul 24 14:19:26 2015<br>
New Revision: 243146<br>
<br></span>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject-3Frev-3D243146-26view-3Drev&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=LNcHPhSuKFzNIaAsh-ZdJc_EoC2PglYRL1VjEmtEayY&s=9zpmd61-FGaft7oTzQxLCKItiR8J3wUVABWDz_w5soc&e=" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=243146&view=rev</a><span class=""><br>
Log:<br>
Add const to some Type* parameters which didn't need to be mutable.  NFC.<br>
<br>
We were only getting the size of the type which doesn't need to modify<br>
the type.<br>
<br>
Modified:<br>
    llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp<br>
    llvm/trunk/lib/Target/X86/X86ISelLowering.cpp<br>
<br>
Modified: llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp<br></span>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_lib_Target_PowerPC_PPCISelLowering.cpp-3Frev-3D243146-26r1-3D243145-26r2-3D243146-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=LNcHPhSuKFzNIaAsh-ZdJc_EoC2PglYRL1VjEmtEayY&s=GhCkUabblkOywo8akktGbrCkmQdNzJLPoUspcGeO8Wc&e=" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp?rev=243146&r1=243145&r2=243146&view=diff</a><div><div class="h5"><br>
==============================================================================<br>
--- llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp (original)<br>
+++ llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp Fri Jul 24 14:19:26 2015<br>
@@ -925,22 +925,22 @@ PPCTargetLowering::PPCTargetLowering(con<br>
<br>
 /// getMaxByValAlign - Helper for getByValTypeAlignment to determine<br>
 /// the desired ByVal argument alignment.<br>
-static void getMaxByValAlign(Type *Ty, unsigned &MaxAlign,<br>
+static void getMaxByValAlign(const Type *Ty, unsigned &MaxAlign,<br>
                              unsigned MaxMaxAlign) {<br>
   if (MaxAlign == MaxMaxAlign)<br>
     return;<br>
-  if (VectorType *VTy = dyn_cast<VectorType>(Ty)) {<br>
+  if (const VectorType *VTy = dyn_cast<VectorType>(Ty)) {<br>
     if (MaxMaxAlign >= 32 && VTy->getBitWidth() >= 256)<br>
       MaxAlign = 32;<br>
     else if (VTy->getBitWidth() >= 128 && MaxAlign < 16)<br>
       MaxAlign = 16;<br>
-  } else if (ArrayType *ATy = dyn_cast<ArrayType>(Ty)) {<br>
+  } else if (const ArrayType *ATy = dyn_cast<ArrayType>(Ty)) {<br>
     unsigned EltAlign = 0;<br>
     getMaxByValAlign(ATy->getElementType(), EltAlign, MaxMaxAlign);<br>
     if (EltAlign > MaxAlign)<br>
       MaxAlign = EltAlign;<br>
-  } else if (StructType *STy = dyn_cast<StructType>(Ty)) {<br>
-    for (auto *EltTy : STy->elements()) {<br>
+  } else if (const StructType *STy = dyn_cast<StructType>(Ty)) {<br>
+    for (const auto *EltTy : STy->elements()) {<br>
       unsigned EltAlign = 0;<br>
       getMaxByValAlign(EltTy, EltAlign, MaxMaxAlign);<br>
       if (EltAlign > MaxAlign)<br>
<br>
Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp<br></div></div>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_lib_Target_X86_X86ISelLowering.cpp-3Frev-3D243146-26r1-3D243145-26r2-3D243146-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=LNcHPhSuKFzNIaAsh-ZdJc_EoC2PglYRL1VjEmtEayY&s=2YGstlsad0mCnM-vBzAt8oU0zAxjhqPiLicDB2Z5ZsM&e=" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=243146&r1=243145&r2=243146&view=diff</a><div><div class="h5"><br>
==============================================================================<br>
--- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)<br>
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Fri Jul 24 14:19:26 2015<br>
@@ -1806,19 +1806,19 @@ EVT X86TargetLowering::getSetCCResultTyp<br>
<br>
 /// Helper for getByValTypeAlignment to determine<br>
 /// the desired ByVal argument alignment.<br>
-static void getMaxByValAlign(Type *Ty, unsigned &MaxAlign) {<br>
+static void getMaxByValAlign(const Type *Ty, unsigned &MaxAlign) {<br>
   if (MaxAlign == 16)<br>
     return;<br>
-  if (VectorType *VTy = dyn_cast<VectorType>(Ty)) {<br>
+  if (const VectorType *VTy = dyn_cast<VectorType>(Ty)) {<br>
     if (VTy->getBitWidth() == 128)<br>
       MaxAlign = 16;<br>
-  } else if (ArrayType *ATy = dyn_cast<ArrayType>(Ty)) {<br>
+  } else if (const ArrayType *ATy = dyn_cast<ArrayType>(Ty)) {<br>
     unsigned EltAlign = 0;<br>
     getMaxByValAlign(ATy->getElementType(), EltAlign);<br>
     if (EltAlign > MaxAlign)<br>
       MaxAlign = EltAlign;<br>
-  } else if (StructType *STy = dyn_cast<StructType>(Ty)) {<br>
-    for (auto *EltTy : STy->elements()) {<br>
+  } else if (const StructType *STy = dyn_cast<StructType>(Ty)) {<br>
+    for (const auto *EltTy : STy->elements()) {<br>
       unsigned EltAlign = 0;<br>
       getMaxByValAlign(EltTy, EltAlign);<br>
       if (EltAlign > MaxAlign)<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu" target="_blank">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</div></div></blockquote></div><br><br clear="all"><span class="HOEnZb"><font color="#888888"><div><br></div>-- <br><div>~Craig</div>
</font></span></div>
</div></blockquote></div><br></div><br>_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
<br></blockquote></div><br></div></div>