[llvm] r211925 - [NVPTX] Just use getTypeAllocSize() when computing return value size for structures and vectors
Justin Holewinski
jholewinski at nvidia.com
Fri Jun 27 11:35:08 PDT 2014
Author: jholewinski
Date: Fri Jun 27 13:35:08 2014
New Revision: 211925
URL: http://llvm.org/viewvc/llvm-project?rev=211925&view=rev
Log:
[NVPTX] Just use getTypeAllocSize() when computing return value size for structures and vectors
Modified:
llvm/trunk/lib/Target/NVPTX/NVPTXAsmPrinter.cpp
Modified: llvm/trunk/lib/Target/NVPTX/NVPTXAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/NVPTX/NVPTXAsmPrinter.cpp?rev=211925&r1=211924&r2=211925&view=diff
==============================================================================
--- llvm/trunk/lib/Target/NVPTX/NVPTXAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/NVPTX/NVPTXAsmPrinter.cpp Fri Jun 27 13:35:08 2014
@@ -734,23 +734,7 @@ void NVPTXAsmPrinter::printReturnValStr(
<< " func_retval0";
} else {
if ((Ty->getTypeID() == Type::StructTyID) || isa<VectorType>(Ty)) {
- SmallVector<EVT, 16> vtparts;
- ComputeValueVTs(*TLI, Ty, vtparts);
- unsigned totalsz = 0;
- for (unsigned i = 0, e = vtparts.size(); i != e; ++i) {
- unsigned elems = 1;
- EVT elemtype = vtparts[i];
- if (vtparts[i].isVector()) {
- elems = vtparts[i].getVectorNumElements();
- elemtype = vtparts[i].getVectorElementType();
- }
- for (unsigned j = 0, je = elems; j != je; ++j) {
- unsigned sz = elemtype.getSizeInBits();
- if (elemtype.isInteger() && (sz < 8))
- sz = 8;
- totalsz += sz / 8;
- }
- }
+ unsigned totalsz = TD->getTypeAllocSize(Ty);
unsigned retAlignment = 0;
if (!llvm::getAlign(*F, 0, retAlignment))
retAlignment = TD->getABITypeAlignment(Ty);
More information about the llvm-commits
mailing list