@@ -2026,17 +2026,15 @@ void Verifier::verifyParameterAttrs(AttributeSet Attrs, Type *Ty,
20262026 " huge alignment values are unsupported" , V);
20272027 }
20282028 if (Attrs.hasAttribute (Attribute::ByVal)) {
2029+ Type *ByValTy = Attrs.getByValType ();
20292030 SmallPtrSet<Type *, 4 > Visited;
2030- Check (Attrs. getByValType () ->isSized (&Visited),
2031+ Check (ByValTy ->isSized (&Visited),
20312032 " Attribute 'byval' does not support unsized types!" , V);
2032- // Check if it's a target extension type that disallows being used on the
2033- // stack.
2034- if (auto *TTy = dyn_cast<TargetExtType>(Attrs.getByValType ())) {
2035- Check (TTy->hasProperty (TargetExtType::CanBeLocal),
2036- " 'byval' argument has illegal target extension type" , V);
2037- }
2038- Check (DL.getTypeAllocSize (Attrs.getByValType ()).getKnownMinValue () <
2039- (1ULL << 32 ),
2033+ // Check if it is or contains a target extension type that disallows being
2034+ // used on the stack.
2035+ Check (!ByValTy->containsNonLocalTargetExtType (),
2036+ " 'byval' argument has illegal target extension type" , V);
2037+ Check (DL.getTypeAllocSize (ByValTy).getKnownMinValue () < (1ULL << 32 ),
20402038 " huge 'byval' arguments are unsupported" , V);
20412039 }
20422040 if (Attrs.hasAttribute (Attribute::ByRef)) {
@@ -4329,15 +4327,13 @@ void Verifier::verifySwiftErrorValue(const Value *SwiftErrorVal) {
43294327}
43304328
43314329void Verifier::visitAllocaInst (AllocaInst &AI) {
4330+ Type *Ty = AI.getAllocatedType ();
43324331 SmallPtrSet<Type*, 4 > Visited;
4333- Check (AI.getAllocatedType ()->isSized (&Visited),
4334- " Cannot allocate unsized type" , &AI);
4332+ Check (Ty->isSized (&Visited), " Cannot allocate unsized type" , &AI);
43354333 // Check if it's a target extension type that disallows being used on the
43364334 // stack.
4337- if (auto *TTy = dyn_cast<TargetExtType>(AI.getAllocatedType ())) {
4338- Check (TTy->hasProperty (TargetExtType::CanBeLocal),
4339- " Alloca has illegal target extension type" , &AI);
4340- }
4335+ Check (!Ty->containsNonLocalTargetExtType (),
4336+ " Alloca has illegal target extension type" , &AI);
43414337 Check (AI.getArraySize ()->getType ()->isIntegerTy (),
43424338 " Alloca array size must have integer type" , &AI);
43434339 if (MaybeAlign A = AI.getAlign ()) {
@@ -4346,8 +4342,7 @@ void Verifier::visitAllocaInst(AllocaInst &AI) {
43464342 }
43474343
43484344 if (AI.isSwiftError ()) {
4349- Check (AI.getAllocatedType ()->isPointerTy (),
4350- " swifterror alloca must have pointer type" , &AI);
4345+ Check (Ty->isPointerTy (), " swifterror alloca must have pointer type" , &AI);
43514346 Check (!AI.isArrayAllocation (),
43524347 " swifterror alloca must not be array allocation" , &AI);
43534348 verifySwiftErrorValue (&AI);
0 commit comments