[PATCH] D17872: [NVPTX] Add a truncate DAG node to some calls.

Justin Lebar via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 31 18:14:37 PDT 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL265091: [NVPTX] Add a truncate DAG node to some calls. (authored by jlebar).

Changed prior to commit:
  http://reviews.llvm.org/D17872?vs=52304&id=52319#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D17872

Files:
  llvm/trunk/lib/Target/NVPTX/NVPTXISelLowering.cpp

Index: llvm/trunk/lib/Target/NVPTX/NVPTXISelLowering.cpp
===================================================================
--- llvm/trunk/lib/Target/NVPTX/NVPTXISelLowering.cpp
+++ llvm/trunk/lib/Target/NVPTX/NVPTXISelLowering.cpp
@@ -1620,21 +1620,29 @@
       for (unsigned i = 0, e = Ins.size(); i != e; ++i) {
         unsigned sz = VTs[i].getSizeInBits();
         unsigned AlignI = GreatestCommonDivisor64(RetAlign, Offsets[i]);
-        bool needTruncate = sz < 8;
-        if (VTs[i].isInteger() && (sz < 8))
+        bool needTruncate = false;
+        if (VTs[i].isInteger() && sz < 8) {
           sz = 8;
+          needTruncate = true;
+        }
 
         SmallVector<EVT, 4> LoadRetVTs;
         EVT TheLoadType = VTs[i];
         if (retTy->isIntegerTy() && DL.getTypeAllocSizeInBits(retTy) < 32) {
           // This is for integer types only, and specifically not for
           // aggregates.
           LoadRetVTs.push_back(MVT::i32);
           TheLoadType = MVT::i32;
+          needTruncate = true;
         } else if (sz < 16) {
           // If loading i1/i8 result, generate
           //   load i8 (-> i16)
           //   trunc i16 to i1/i8
+
+          // FIXME: Do we need to set needTruncate to true here, too?  We could
+          // not figure out what this branch is for in D17872, so we left it
+          // alone.  The comment above about loading i1/i8 may be wrong, as the
+          // branch above seems to cover integers of size < 32.
           LoadRetVTs.push_back(MVT::i16);
         } else
           LoadRetVTs.push_back(Ins[i].VT);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D17872.52319.patch
Type: text/x-patch
Size: 1582 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160401/a72e1977/attachment.bin>


More information about the llvm-commits mailing list