<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Nov 6, 2014 at 8:26 AM, David Blaikie <span dir="ltr"><<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote"><span class="">On Thu, Nov 6, 2014 at 6:32 AM, Aaron Ballman <span dir="ltr"><<a href="mailto:aaron@aaronballman.com" target="_blank">aaron@aaronballman.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: aaronballman<br>
Date: Thu Nov  6 08:32:30 2014<br>
New Revision: 221454<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=221454&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=221454&view=rev</a><br>
Log:<br>
Fixing some -Wcast-qual warnings; NFC.<br>
<br>
Modified:<br>
    llvm/trunk/lib/Target/NVPTX/NVPTXLowerStructArgs.cpp<br>
<br>
Modified: llvm/trunk/lib/Target/NVPTX/NVPTXLowerStructArgs.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/NVPTX/NVPTXLowerStructArgs.cpp?rev=221454&r1=221453&r2=221454&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/NVPTX/NVPTXLowerStructArgs.cpp?rev=221454&r1=221453&r2=221454&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/Target/NVPTX/NVPTXLowerStructArgs.cpp (original)<br>
+++ llvm/trunk/lib/Target/NVPTX/NVPTXLowerStructArgs.cpp Thu Nov  6 08:32:30 2014<br>
@@ -64,7 +64,7 @@ void NVPTXLowerStructArgs::handleParam(A<br>
   const Type *StructType = PType->getElementType();<br>
<br>
   AllocaInst *AllocA =<br>
-    new AllocaInst((Type *)StructType, Arg->getName(), FirstInst);<br>
+    new AllocaInst(const_cast<Type *>(StructType), Arg->getName(), FirstInst);<br></blockquote><div><br></div></span><div>Why is StructType a const Type* anyway? Types are immutable and we (I) removed const from all references to them years ago... </div><div><div class="h5"><div> </div></div></div></div></div></div></blockquote><div><br></div><div><br></div><div>I'm doing a cleanup on this file right now, and will take a look at this cast as well.</div><div><br></div><div>Eli</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><div class="h5"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
   /* Set the alignment to alignment of the byval parameter. This is because,<br>
    * later load/stores assume that alignment, and we are going to replace<br>
@@ -79,9 +79,9 @@ void NVPTXLowerStructArgs::handleParam(A<br>
     Type::getInt8PtrTy(Func->getParent()->getContext(), ADDRESS_SPACE_PARAM),<br>
     Type::getInt8PtrTy(Func->getParent()->getContext(), ADDRESS_SPACE_GENERIC)<br>
   };<br>
-  Function *CvtFunc = (Function *)Intrinsic::getDeclaration(<br>
+  Function *CvtFunc = Intrinsic::getDeclaration(<br>
       Func->getParent(), Intrinsic::nvvm_ptr_gen_to_param,<br>
-      ArrayRef<Type *>((Type **)CvtTypes, 2));<br>
+      ArrayRef<Type *>(const_cast<Type **>(CvtTypes), 2));<br>
   std::vector<Value *> BC1;<br>
   BC1.push_back(<br>
       new BitCastInst(Arg, Type::getInt8PtrTy(Func->getParent()->getContext(),<br>
@@ -90,9 +90,10 @@ void NVPTXLowerStructArgs::handleParam(A<br>
   CallInst *CallCVT = CallInst::Create(CvtFunc, ArrayRef<Value *>(BC1),<br>
                                        "cvt_to_param", FirstInst);<br>
<br>
-  BitCastInst *BitCast = new BitCastInst(<br>
-      CallCVT, PointerType::get((Type *)StructType, ADDRESS_SPACE_PARAM),<br>
-      Arg->getName(), FirstInst);<br>
+  BitCastInst *BitCast =<br>
+      new BitCastInst(CallCVT, PointerType::get(const_cast<Type *>(StructType),<br>
+                                                ADDRESS_SPACE_PARAM),<br>
+                      Arg->getName(), FirstInst);<br>
   LoadInst *LI = new LoadInst(BitCast, Arg->getName(), FirstInst);<br>
   new StoreInst(LI, AllocA, FirstInst);<br>
 }<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" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</blockquote></div></div></div><br></div></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" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
<br></blockquote></div><br></div></div>