Look through struct wrapped types for inline asm statments.
authorEric Christopher <echristo@apple.com>
Mon, 9 May 2011 20:04:43 +0000 (20:04 +0000)
committerEric Christopher <echristo@apple.com>
Mon, 9 May 2011 20:04:43 +0000 (20:04 +0000)
Patch by Evan Cheng.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131093 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
lib/CodeGen/SelectionDAG/TargetLowering.cpp

index 366c1307c948331b2a2980ee494a05e4a54b6c93..a01e2b86c2b7389b4313deb8a9fa30d5a44df6f3 100644 (file)
@@ -5268,6 +5268,7 @@ public:
 
     const llvm::Type *OpTy = CallOperandVal->getType();
 
+    // FIXME: code duplicated from TargetLowering::ParseConstraints().
     // If this is an indirect operand, the operand is a pointer to the
     // accessed type.
     if (isIndirect) {
@@ -5277,6 +5278,11 @@ public:
       OpTy = PtrTy->getElementType();
     }
 
+    // Look for vector wrapped in a struct. e.g. { <16 x i8> }.
+    if (const StructType *STy = dyn_cast<StructType>(OpTy))
+      if (STy->getNumElements() == 1)
+        OpTy = STy->getElementType(0);
+
     // If OpTy is not a single value, it may be a struct/union that we
     // can tile with integers.
     if (!OpTy->isSingleValueType() && OpTy->isSized()) {
index d163ebf82f73b9cbe57a31a53d34ccff4739f943..b301e3bd3ddbad8b9280f0cdb008dc530e304f58 100644 (file)
@@ -2812,6 +2812,12 @@ TargetLowering::AsmOperandInfoVector TargetLowering::ParseConstraints(
           report_fatal_error("Indirect operand for inline asm not a pointer!");
         OpTy = PtrTy->getElementType();
       }
+      
+      // Look for vector wrapped in a struct. e.g. { <16 x i8> }.
+      if (const StructType *STy = dyn_cast<StructType>(OpTy))
+        if (STy->getNumElements() == 1)
+          OpTy = STy->getElementType(0);
+
       // If OpTy is not a single value, it may be a struct/union that we
       // can tile with integers.
       if (!OpTy->isSingleValueType() && OpTy->isSized()) {