Index: lib/Target/NVPTX/NVPTXISelLowering.cpp =================================================================== --- lib/Target/NVPTX/NVPTXISelLowering.cpp +++ lib/Target/NVPTX/NVPTXISelLowering.cpp @@ -1620,9 +1620,11 @@ 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 LoadRetVTs; EVT TheLoadType = VTs[i]; @@ -1631,6 +1633,7 @@ // aggregates. LoadRetVTs.push_back(MVT::i32); TheLoadType = MVT::i32; + needTruncate = true; } else if (sz < 16) { // If loading i1/i8 result, generate // load i8 (-> i16)