[AArch64] Correctly deal with VPR stack parameter passing.
[oota-llvm.git] / lib / Target / AArch64 / AArch64ISelLowering.cpp
index 7bb07ccef323c360cf139a295bf287f66f586517..4bc22c338e51d359c6b3bda9027214bd96cf04e6 100644 (file)
@@ -1711,7 +1711,9 @@ SDValue AArch64TargetLowering::LowerFormalArguments(
       InVals.push_back(FrameIdxN);
 
       continue;
-    } if (VA.isRegLoc()) {
+    }
+    
+    if (VA.isRegLoc()) {
       // Arguments stored in registers.
       EVT RegVT = VA.getLocVT();
 
@@ -1772,25 +1774,30 @@ SDValue AArch64TargetLowering::LowerFormalArguments(
       SDValue FIN = DAG.getFrameIndex(FI, getPointerTy());
       SDValue ArgValue;
 
+      // For NON_EXTLOAD, generic code in getLoad assert(ValVT == MemVT)
       ISD::LoadExtType ExtType = ISD::NON_EXTLOAD;
+      MVT MemVT = VA.getValVT();
+
       switch (VA.getLocInfo()) {
       default:
         break;
       case CCValAssign::SExt:
         ExtType = ISD::SEXTLOAD;
+        MemVT = VA.getLocVT();
         break;
       case CCValAssign::ZExt:
         ExtType = ISD::ZEXTLOAD;
+        MemVT = VA.getLocVT();
         break;
       case CCValAssign::AExt:
         ExtType = ISD::EXTLOAD;
+        MemVT = VA.getLocVT();
         break;
       }
 
       ArgValue = DAG.getExtLoad(ExtType, DL, VA.getValVT(), Chain, FIN,
                                 MachinePointerInfo::getFixedStack(FI),
-                                VA.getLocVT(),
-                                false, false, false, 0);
+                                MemVT, false, false, false, 0);
 
       InVals.push_back(ArgValue);
     }