[llvm-commits] CVS: llvm/lib/Target/TargetData.cpp

Christopher Lamb christopher.lamb at gmail.com
Sun Apr 22 14:54:31 PDT 2007



Changes in directory llvm/lib/Target:

TargetData.cpp updated: 1.106 -> 1.107
---
Log message:

Support alignment queries for degenerate (length 1) vectors.


---
Diffs of the changes:  (+8 -2)

 TargetData.cpp |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)


Index: llvm/lib/Target/TargetData.cpp
diff -u llvm/lib/Target/TargetData.cpp:1.106 llvm/lib/Target/TargetData.cpp:1.107
--- llvm/lib/Target/TargetData.cpp:1.106	Mon Apr  9 14:26:30 2007
+++ llvm/lib/Target/TargetData.cpp	Sun Apr 22 16:54:13 2007
@@ -493,9 +493,15 @@
   case Type::DoubleTyID:
     AlignType = FLOAT_ALIGN;
     break;
-  case Type::VectorTyID:
-    AlignType = VECTOR_ALIGN;
+  case Type::VectorTyID: {
+    const VectorType *VTy = cast<VectorType>(Ty);
+    // Degenerate vectors are assumed to be scalar-ized
+    if (VTy->getNumElements() == 1)
+      return getAlignment(VTy->getElementType(), abi_or_pref);
+    else
+      AlignType = VECTOR_ALIGN;
     break;
+  }
   default:
     assert(0 && "Bad type for getAlignment!!!");
     break;






More information about the llvm-commits mailing list