[llvm-commits] [PATCH] Change return type of getOptimalMemOpType() from EVT to MVT.

Craig Topper craig.topper at gmail.com
Sat Nov 24 19:05:05 PST 2012


Should probably add a bitsGT to MVT for this part of the second patch. The
trip through EVT will add checks for handling Extended types.

       LVT = (MVT::SimpleValueType)(LVT.SimpleTy - 1);
     assert(LVT.isInteger());

-    if (VT.bitsGT(LVT))
+    if (EVT(VT).bitsGT(LVT))
       VT = LVT;
   }

I don't realy like the intialization of VTSize being in the for loop
header. It makes it confusing since VTSize isn't the variable being used
for iteration. I'm also not sure that's even safe to pull out of the loop
since VT can change inside the loop. For the same reason, I dont' think you
can subtract VTSize.

-  unsigned NumMemOps = 0;
-  while (Size != 0) {
-    unsigned VTSize = VT.getSizeInBits() / 8;
+  for (unsigned VTSize = VT.getSizeInBits() / 8; Size != 0; Size -=
VTSize) {


I'm pretty sure this change isn't equivalent either because it allows
MemOps to grow past the limit which it didn't previously do.

-    if (++NumMemOps > Limit)
-      return false;
     MemOps.push_back(VT);
-    Size -= VTSize;
+    if (MemOps.size() > Limit)
+      return false;

On Fri, Nov 23, 2012 at 3:44 AM, Patrik Hägglund H <
patrik.h.hagglund at ericsson.com> wrote:

> Here are two small patches that change the return type of
> getOptimalMemOpType()
>  from EVT to MVT. In the second patch there is also some other minor
> cleanups.
>
> Let me know if you have any objections. Otherwise, I will commit them.
>
> Regards,
> Patrik Hägglund
>
> [PATCH 1/2] Cleanup: Change return type of getOptimalMemOpType()
>  from EVT to MVT.
>
> The user of this function (FindOptimalMemOpLowering) asserts if not
> receiving an MVT. Therefore, it makes no sense to use EVT.
> ---
>  include/llvm/Target/TargetLowering.h   | 4 ++--
>  lib/Target/ARM/ARMISelLowering.cpp     | 2 +-
>  lib/Target/ARM/ARMISelLowering.h       | 2 +-
>  lib/Target/Mips/MipsISelLowering.cpp   | 2 +-
>  lib/Target/Mips/MipsISelLowering.h     | 2 +-
>  lib/Target/PowerPC/PPCISelLowering.cpp | 4 ++--
>  lib/Target/PowerPC/PPCISelLowering.h   | 4 ++--
>  lib/Target/X86/X86ISelLowering.cpp     | 4 ++--
>  lib/Target/X86/X86ISelLowering.h       | 4 ++--
>
>
> [PATCH 2/2] Cleanup: Use an MVT instead of EVT. Clean up loop logic.
>
> The code asserts at VT.getSimpleVT() if VT isn't an MVT.
> ---
>  lib/CodeGen/SelectionDAG/SelectionDAG.cpp | 19 ++++++++-----------
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
>


-- 
~Craig
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20121124/0fe6ef5c/attachment.html>


More information about the llvm-commits mailing list