&CI);
break;
case Intrinsic::stackprotector:
- Assert1(isa<AllocaInst>(CI.getOperand(2)),
+ Assert1(isa<AllocaInst>(CI.getOperand(2)->stripPointerCasts()),
"llvm.stackprotector parameter #2 must resolve to an alloca.",
&CI);
break;
if (VT < 0) {
int Match = ~VT;
- if (Match == 0) {
- if (Ty != FTy->getReturnType()) {
+ const Type *RetTy = FTy->getReturnType();
+ const StructType *ST = dyn_cast<StructType>(RetTy);
+ unsigned NumRets = 1;
+
+ if (ST)
+ NumRets = ST->getNumElements();
+
+ if (Match <= static_cast<int>(NumRets - 1)) {
+ if (ST)
+ RetTy = ST->getElementType(Match);
+
+ if (Ty != RetTy) {
CheckFailed("Intrinsic parameter #" + utostr(ArgNo - 1) + " does not "
"match return type.", F);
return false;