llvm.org GIT mirror llvm / 1f8f049
[IR] Make paramHasAttr to use arg indices instead of attr indices This avoids the confusing 'CS.paramHasAttr(ArgNo + 1, Foo)' pattern. Previously we were testing return value attributes with index 0, so I introduced hasReturnAttr() for that use case. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300367 91177308-0d34-0410-b5e6-96231b3b80d8 Reid Kleckner 2 years ago
21 changed file(s) with 116 addition(s) and 84 deletion(s). Raw diff Collapse all Expand all
8282 RetTy = ResultTy;
8383 Callee = Target;
8484
85 IsInReg = Call.paramHasAttr(0, Attribute::InReg);
85 IsInReg = Call.hasRetAttr(Attribute::InReg);
8686 DoesNotReturn = Call.doesNotReturn();
8787 IsVarArg = FuncTy->isVarArg();
8888 IsReturnValueUsed = !Call.getInstruction()->use_empty();
89 RetSExt = Call.paramHasAttr(0, Attribute::SExt);
90 RetZExt = Call.paramHasAttr(0, Attribute::ZExt);
89 RetSExt = Call.hasRetAttr(Attribute::SExt);
90 RetZExt = Call.hasRetAttr(Attribute::ZExt);
9191
9292 CallConv = Call.getCallingConv();
9393 Args = std::move(ArgsList);
106106 Callee = Call.getCalledValue();
107107 Symbol = Target;
108108
109 IsInReg = Call.paramHasAttr(0, Attribute::InReg);
109 IsInReg = Call.hasRetAttr(Attribute::InReg);
110110 DoesNotReturn = Call.doesNotReturn();
111111 IsVarArg = FuncTy->isVarArg();
112112 IsReturnValueUsed = !Call.getInstruction()->use_empty();
113 RetSExt = Call.paramHasAttr(0, Attribute::SExt);
114 RetZExt = Call.paramHasAttr(0, Attribute::ZExt);
113 RetSExt = Call.hasRetAttr(Attribute::SExt);
114 RetZExt = Call.hasRetAttr(Attribute::ZExt);
115115
116116 CallConv = Call.getCallingConv();
117117 Args = std::move(ArgsList);
356356 CALLSITE_DELEGATE_GETTER(hasFnAttr(Kind));
357357 }
358358
359 /// Return true if this return value has the given attribute.
360 bool hasRetAttr(Attribute::AttrKind Kind) const {
361 CALLSITE_DELEGATE_GETTER(hasRetAttr(Kind));
362 }
363
359364 /// Return true if the call or the callee has the given attribute.
360 bool paramHasAttr(unsigned i, Attribute::AttrKind Kind) const {
361 CALLSITE_DELEGATE_GETTER(paramHasAttr(i, Kind));
365 bool paramHasAttr(unsigned ArgNo, Attribute::AttrKind Kind) const {
366 CALLSITE_DELEGATE_GETTER(paramHasAttr(ArgNo, Kind));
362367 }
363368
364369 Attribute getAttribute(unsigned i, Attribute::AttrKind Kind) const {
553558
554559 /// Determine whether this argument is passed by value.
555560 bool isByValArgument(unsigned ArgNo) const {
556 return paramHasAttr(ArgNo + 1, Attribute::ByVal);
561 return paramHasAttr(ArgNo, Attribute::ByVal);
557562 }
558563
559564 /// Determine whether this argument is passed in an alloca.
560565 bool isInAllocaArgument(unsigned ArgNo) const {
561 return paramHasAttr(ArgNo + 1, Attribute::InAlloca);
566 return paramHasAttr(ArgNo, Attribute::InAlloca);
562567 }
563568
564569 /// Determine whether this argument is passed by value or in an alloca.
565570 bool isByValOrInAllocaArgument(unsigned ArgNo) const {
566 return paramHasAttr(ArgNo + 1, Attribute::ByVal) ||
567 paramHasAttr(ArgNo + 1, Attribute::InAlloca);
571 return paramHasAttr(ArgNo, Attribute::ByVal) ||
572 paramHasAttr(ArgNo, Attribute::InAlloca);
568573 }
569574
570575 /// Determine if there are is an inalloca argument. Only the last argument can
571576 /// have the inalloca attribute.
572577 bool hasInAllocaArgument() const {
573 return paramHasAttr(arg_size(), Attribute::InAlloca);
578 return !arg_empty() && paramHasAttr(arg_size() - 1, Attribute::InAlloca);
574579 }
575580
576581 bool doesNotAccessMemory(unsigned OpNo) const {
591596 /// This may be because it has the nonnull attribute, or because at least
592597 /// one byte is dereferenceable and the pointer is in addrspace(0).
593598 bool isReturnNonNull() const {
594 if (paramHasAttr(0, Attribute::NonNull))
599 if (hasRetAttr(Attribute::NonNull))
595600 return true;
596601 else if (getDereferenceableBytes(0) > 0 &&
597602 getType()->getPointerAddressSpace() == 0)
16801680 return hasFnAttrImpl(Kind);
16811681 }
16821682
1683 /// Determine whether the call or the callee has the given attributes.
1684 bool paramHasAttr(unsigned i, Attribute::AttrKind Kind) const;
1683 /// Determine whether the return value has the given attribute.
1684 bool hasRetAttr(Attribute::AttrKind Kind) const;
1685
1686 /// Determine whether the argument or parameter has the given attribute.
1687 bool paramHasAttr(unsigned ArgNo, Attribute::AttrKind Kind) const;
16851688
16861689 /// Get the attribute of a given kind at a position.
16871690 Attribute getAttribute(unsigned i, Attribute::AttrKind Kind) const {
18201823 return false;
18211824
18221825 // Be friendly and also check the callee.
1823 return paramHasAttr(1, Attribute::StructRet);
1826 return paramHasAttr(0, Attribute::StructRet);
18241827 }
18251828
18261829 /// Determine if any call argument is an aggregate passed by value.
37663769 return hasFnAttrImpl(Kind);
37673770 }
37683771
3769 /// Determine whether the call or the callee has the given attributes.
3770 bool paramHasAttr(unsigned i, Attribute::AttrKind Kind) const;
3772 /// Determine whether the return value has the given attribute.
3773 bool hasRetAttr(Attribute::AttrKind Kind) const;
3774
3775 /// Determine whether the argument or parameter has the given attribute.
3776 bool paramHasAttr(unsigned ArgNo, Attribute::AttrKind Kind) const;
37713777
37723778 /// Get the attribute of a given kind at a position.
37733779 Attribute getAttribute(unsigned i, Attribute::AttrKind Kind) const {
39013907 return false;
39023908
39033909 // Be friendly and also check the callee.
3904 return paramHasAttr(1, Attribute::StructRet);
3910 return paramHasAttr(0, Attribute::StructRet);
39053911 }
39063912
39073913 /// Determine if any call argument is an aggregate passed by value.
185185 IsNest(false), IsByVal(false), IsInAlloca(false), IsReturned(false),
186186 IsSwiftSelf(false), IsSwiftError(false) {}
187187
188 void setAttributes(ImmutableCallSite *CS, unsigned AttrIdx);
188 void setAttributes(ImmutableCallSite *CS, unsigned ArgIdx);
189189 };
190190 typedef std::vector ArgListTy;
191191
26792679 ImmutableCallSite &Call) {
26802680 RetTy = ResultType;
26812681
2682 IsInReg = Call.paramHasAttr(0, Attribute::InReg);
2682 IsInReg = Call.hasRetAttr(Attribute::InReg);
26832683 DoesNotReturn =
26842684 Call.doesNotReturn() ||
26852685 (!Call.isInvoke() &&
26862686 isa(Call.getInstruction()->getNextNode()));
26872687 IsVarArg = FTy->isVarArg();
26882688 IsReturnValueUsed = !Call.getInstruction()->use_empty();
2689 RetSExt = Call.paramHasAttr(0, Attribute::SExt);
2690 RetZExt = Call.paramHasAttr(0, Attribute::ZExt);
2689 RetSExt = Call.hasRetAttr(Attribute::SExt);
2690 RetZExt = Call.hasRetAttr(Attribute::ZExt);
26912691
26922692 Callee = Target;
26932693
696696
697697 bool llvm::isNoAliasCall(const Value *V) {
698698 if (auto CS = ImmutableCallSite(V))
699 return CS.paramHasAttr(0, Attribute::NoAlias);
699 return CS.hasRetAttr(Attribute::NoAlias);
700700 return false;
701701 }
702702
636636 /// Returns true if this is a writeonly (i.e Mod only) parameter.
637637 static bool isWriteOnlyParam(ImmutableCallSite CS, unsigned ArgIdx,
638638 const TargetLibraryInfo &TLI) {
639 if (CS.paramHasAttr(ArgIdx + 1, Attribute::WriteOnly))
639 if (CS.paramHasAttr(ArgIdx, Attribute::WriteOnly))
640640 return true;
641641
642642 // We can bound the aliasing properties of memset_pattern16 just as we can
665665 if (isWriteOnlyParam(CS, ArgIdx, TLI))
666666 return MRI_Mod;
667667
668 if (CS.paramHasAttr(ArgIdx + 1, Attribute::ReadOnly))
668 if (CS.paramHasAttr(ArgIdx, Attribute::ReadOnly))
669669 return MRI_Ref;
670670
671 if (CS.paramHasAttr(ArgIdx + 1, Attribute::ReadNone))
671 if (CS.paramHasAttr(ArgIdx, Attribute::ReadNone))
672672 return MRI_NoModRef;
673673
674674 return AAResultBase::getArgModRefInfo(CS, ArgIdx);
582582 }
583583
584584 bool CallAnalyzer::paramHasAttr(Argument *A, Attribute::AttrKind Attr) {
585 unsigned ArgNo = A->getArgNo();
586 return CandidateCS.paramHasAttr(ArgNo + 1, Attr);
585 return CandidateCS.paramHasAttr(A->getArgNo(), Attr);
587586 }
588587
589588 bool CallAnalyzer::isKnownNonNullInCallee(Value *V) {
182182
183183 static bool hasNoAliasAttr(const Value *V, bool LookThroughBitCast) {
184184 ImmutableCallSite CS(LookThroughBitCast ? V->stripPointerCasts() : V);
185 return CS && CS.paramHasAttr(AttributeList::ReturnIndex, Attribute::NoAlias);
185 return CS && CS.hasRetAttr(Attribute::NoAlias);
186186 }
187187
188188
693693 Args.reserve(NumArgs);
694694
695695 // Populate the argument list.
696 // Attributes for args start at offset 1, after the return attribute.
697696 ImmutableCallSite CS(CI);
698 for (unsigned ArgI = ArgIdx, ArgE = ArgIdx + NumArgs, AttrI = ArgIdx + 1;
699 ArgI != ArgE; ++ArgI) {
697 for (unsigned ArgI = ArgIdx, ArgE = ArgIdx + NumArgs; ArgI != ArgE; ++ArgI) {
700698 Value *V = CI->getOperand(ArgI);
701699
702700 assert(!V->getType()->isEmptyTy() && "Empty type passed to intrinsic.");
704702 ArgListEntry Entry;
705703 Entry.Val = V;
706704 Entry.Ty = V->getType();
707 Entry.setAttributes(&CS, AttrI);
705 Entry.setAttributes(&CS, ArgIdx);
708706 Args.push_back(Entry);
709707 }
710708
906904 ArgListEntry Entry;
907905 Entry.Val = V;
908906 Entry.Ty = V->getType();
909 Entry.setAttributes(&CS, ArgI + 1);
907 Entry.setAttributes(&CS, ArgI);
910908 Args.push_back(Entry);
911909 }
912910 TLI.markLibCallAttributes(MF, CS.getCallingConv(), Args);
10431041 Entry.Ty = V->getType();
10441042
10451043 // Skip the first return-type Attribute to get to params.
1046 Entry.setAttributes(&CS, i - CS.arg_begin() + 1);
1044 Entry.setAttributes(&CS, i - CS.arg_begin());
10471045 Args.push_back(Entry);
10481046 }
10491047
58755875 SDValue ArgNode = getValue(V);
58765876 Entry.Node = ArgNode; Entry.Ty = V->getType();
58775877
5878 // Skip the first return-type Attribute to get to params.
5879 Entry.setAttributes(&CS, i - CS.arg_begin() + 1);
5878 Entry.setAttributes(&CS, i - CS.arg_begin());
58805879
58815880 // Use swifterror virtual register as input to the call.
58825881 if (Entry.IsSwiftError && TLI.supportSwiftError()) {
73397338
73407339 // Populate the argument list.
73417340 // Attributes for args start at offset 1, after the return attribute.
7342 for (unsigned ArgI = ArgIdx, ArgE = ArgIdx + NumArgs, AttrI = ArgIdx + 1;
7341 for (unsigned ArgI = ArgIdx, ArgE = ArgIdx + NumArgs;
73437342 ArgI != ArgE; ++ArgI) {
73447343 const Value *V = CS->getOperand(ArgI);
73457344
73487347 TargetLowering::ArgListEntry Entry;
73497348 Entry.Node = getValue(V);
73507349 Entry.Ty = V->getType();
7351 Entry.setAttributes(&CS, AttrI);
7350 Entry.setAttributes(&CS, ArgIdx);
73527351 Args.push_back(Entry);
73537352 }
73547353
9797 /// \brief Set CallLoweringInfo attribute flags based on a call instruction
9898 /// and called function attributes.
9999 void TargetLoweringBase::ArgListEntry::setAttributes(ImmutableCallSite *CS,
100 unsigned AttrIdx) {
101 IsSExt = CS->paramHasAttr(AttrIdx, Attribute::SExt);
102 IsZExt = CS->paramHasAttr(AttrIdx, Attribute::ZExt);
103 IsInReg = CS->paramHasAttr(AttrIdx, Attribute::InReg);
104 IsSRet = CS->paramHasAttr(AttrIdx, Attribute::StructRet);
105 IsNest = CS->paramHasAttr(AttrIdx, Attribute::Nest);
106 IsByVal = CS->paramHasAttr(AttrIdx, Attribute::ByVal);
107 IsInAlloca = CS->paramHasAttr(AttrIdx, Attribute::InAlloca);
108 IsReturned = CS->paramHasAttr(AttrIdx, Attribute::Returned);
109 IsSwiftSelf = CS->paramHasAttr(AttrIdx, Attribute::SwiftSelf);
110 IsSwiftError = CS->paramHasAttr(AttrIdx, Attribute::SwiftError);
111 Alignment = CS->getParamAlignment(AttrIdx);
100 unsigned ArgIdx) {
101 IsSExt = CS->paramHasAttr(ArgIdx, Attribute::SExt);
102 IsZExt = CS->paramHasAttr(ArgIdx, Attribute::ZExt);
103 IsInReg = CS->paramHasAttr(ArgIdx, Attribute::InReg);
104 IsSRet = CS->paramHasAttr(ArgIdx, Attribute::StructRet);
105 IsNest = CS->paramHasAttr(ArgIdx, Attribute::Nest);
106 IsByVal = CS->paramHasAttr(ArgIdx, Attribute::ByVal);
107 IsInAlloca = CS->paramHasAttr(ArgIdx, Attribute::InAlloca);
108 IsReturned = CS->paramHasAttr(ArgIdx, Attribute::Returned);
109 IsSwiftSelf = CS->paramHasAttr(ArgIdx, Attribute::SwiftSelf);
110 IsSwiftError = CS->paramHasAttr(ArgIdx, Attribute::SwiftError);
111 // FIXME: getParamAlignment is off by one from argument index.
112 Alignment = CS->getParamAlignment(ArgIdx + 1);
112113 }
113114
114115 /// Generate a libcall taking the given operands as arguments and returning a
379379 setAttributes(PAL);
380380 }
381381
382 bool CallInst::hasRetAttr(Attribute::AttrKind Kind) const {
383 if (Attrs.hasAttribute(AttributeList::ReturnIndex, Kind))
384 return true;
385
386 // Look at the callee, if available.
387 if (const Function *F = getCalledFunction())
388 return F->getAttributes().hasAttribute(AttributeList::ReturnIndex, Kind);
389 return false;
390 }
391
382392 bool CallInst::paramHasAttr(unsigned i, Attribute::AttrKind Kind) const {
383 assert(i < (getNumArgOperands() + 1) && "Param index out of bounds!");
384
385 if (Attrs.hasAttribute(i, Kind))
393 assert(i < getNumArgOperands() && "Param index out of bounds!");
394
395 if (Attrs.hasParamAttribute(i, Kind))
386396 return true;
387397 if (const Function *F = getCalledFunction())
388 return F->getAttributes().hasAttribute(i, Kind);
398 return F->getAttributes().hasParamAttribute(i, Kind);
389399 return false;
390400 }
391401
399409 // question is a call argument; or be indirectly implied by the kind of its
400410 // containing operand bundle, if the operand is a bundle operand.
401411
412 // FIXME: Avoid these i - 1 calculations and update the API to use zero-based
413 // indices.
402414 if (i < (getNumArgOperands() + 1))
403 return paramHasAttr(i, Kind);
415 return paramHasAttr(i - 1, Kind);
404416
405417 assert(hasOperandBundles() && i >= (getBundleOperandsStartIndex() + 1) &&
406418 "Must be either a call argument or an operand bundle!");
690702 return nullptr;
691703 }
692704
705 bool InvokeInst::hasRetAttr(Attribute::AttrKind Kind) const {
706 if (Attrs.hasAttribute(AttributeList::ReturnIndex, Kind))
707 return true;
708
709 // Look at the callee, if available.
710 if (const Function *F = getCalledFunction())
711 return F->getAttributes().hasAttribute(AttributeList::ReturnIndex, Kind);
712 return false;
713 }
714
693715 bool InvokeInst::paramHasAttr(unsigned i, Attribute::AttrKind Kind) const {
694 assert(i < (getNumArgOperands() + 1) && "Param index out of bounds!");
695
696 if (Attrs.hasAttribute(i, Kind))
716 assert(i < getNumArgOperands() && "Param index out of bounds!");
717
718 if (Attrs.hasParamAttribute(i, Kind))
697719 return true;
698720 if (const Function *F = getCalledFunction())
699 return F->getAttributes().hasAttribute(i, Kind);
721 return F->getAttributes().hasParamAttribute(i, Kind);
700722 return false;
701723 }
702724
710732 // question is an invoke argument; or be indirectly implied by the kind of its
711733 // containing operand bundle, if the operand is a bundle operand.
712734
735 // FIXME: Avoid these i - 1 calculations and update the API to use zero-based
736 // indices.
713737 if (i < (getNumArgOperands() + 1))
714 return paramHasAttr(i, Kind);
738 return paramHasAttr(i - 1, Kind);
715739
716740 assert(hasOperandBundles() && i >= (getBundleOperandsStartIndex() + 1) &&
717741 "Must be either an invoke argument or an operand bundle!");
26182618 // make sure the underlying alloca/parameter it comes from has a swifterror as
26192619 // well.
26202620 for (unsigned i = 0, e = FTy->getNumParams(); i != e; ++i)
2621 if (CS.paramHasAttr(i+1, Attribute::SwiftError)) {
2621 if (CS.paramHasAttr(i, Attribute::SwiftError)) {
26222622 Value *SwiftErrorArg = CS.getArgument(i);
26232623 if (auto AI = dyn_cast(SwiftErrorArg->stripInBoundsOffsets())) {
26242624 Assert(AI->isSwiftError(),
31133113 for (CallSite::arg_iterator I = CS.arg_begin(), E = CS.arg_end();
31143114 I != E; ++I, ++Idx) {
31153115 if (*I == SwiftErrorVal) {
3116 Assert(CS.paramHasAttr(Idx+1, Attribute::SwiftError),
3116 Assert(CS.paramHasAttr(Idx, Attribute::SwiftError),
31173117 "swifterror value when used in a callsite should be marked "
31183118 "with swifterror attribute",
31193119 SwiftErrorVal, CS);
23502350 break;
23512351
23522352 ISD::ArgFlagsTy Flags;
2353 unsigned AttrInd = i - CS.arg_begin() + 1;
2354 if (CS.paramHasAttr(AttrInd, Attribute::SExt))
2353 unsigned ArgIdx = i - CS.arg_begin();
2354 if (CS.paramHasAttr(ArgIdx, Attribute::SExt))
23552355 Flags.setSExt();
2356 if (CS.paramHasAttr(AttrInd, Attribute::ZExt))
2356 if (CS.paramHasAttr(ArgIdx, Attribute::ZExt))
23572357 Flags.setZExt();
23582358
23592359 // FIXME: Only handle *easy* calls for now.
2360 if (CS.paramHasAttr(AttrInd, Attribute::InReg) ||
2361 CS.paramHasAttr(AttrInd, Attribute::StructRet) ||
2362 CS.paramHasAttr(AttrInd, Attribute::SwiftSelf) ||
2363 CS.paramHasAttr(AttrInd, Attribute::SwiftError) ||
2364 CS.paramHasAttr(AttrInd, Attribute::Nest) ||
2365 CS.paramHasAttr(AttrInd, Attribute::ByVal))
2360 if (CS.paramHasAttr(ArgIdx, Attribute::InReg) ||
2361 CS.paramHasAttr(ArgIdx, Attribute::StructRet) ||
2362 CS.paramHasAttr(ArgIdx, Attribute::SwiftSelf) ||
2363 CS.paramHasAttr(ArgIdx, Attribute::SwiftError) ||
2364 CS.paramHasAttr(ArgIdx, Attribute::Nest) ||
2365 CS.paramHasAttr(ArgIdx, Attribute::ByVal))
23662366 return false;
23672367
23682368 Type *ArgTy = (*i)->getType();
5353
5454 void OptimizeReturned::visitCallSite(CallSite CS) {
5555 for (unsigned i = 0, e = CS.getNumArgOperands(); i < e; ++i)
56 if (CS.paramHasAttr(1 + i, Attribute::Returned)) {
56 if (CS.paramHasAttr(0, Attribute::Returned)) {
5757 Instruction *Inst = CS.getInstruction();
5858 Value *Arg = CS.getArgOperand(i);
5959 // Ignore constants, globals, undef, etc.
31603160 return 0;
31613161
31623162 if (CS)
3163 if (CS->arg_empty() || !CS->paramHasAttr(1, Attribute::StructRet) ||
3164 CS->paramHasAttr(1, Attribute::InReg) || Subtarget->isTargetMCU())
3163 if (CS->arg_empty() || !CS->paramHasAttr(0, Attribute::StructRet) ||
3164 CS->paramHasAttr(0, Attribute::InReg) || Subtarget->isTargetMCU())
31653165 return 0;
31663166
31673167 return 4;
827827 case Instruction::Call:
828828 case Instruction::Invoke: {
829829 CallSite CS(RVI);
830 if (CS.paramHasAttr(0, Attribute::NoAlias))
830 if (CS.hasRetAttr(Attribute::NoAlias))
831831 break;
832832 if (CS.getCalledFunction() && SCCNodes.count(CS.getCalledFunction()))
833833 break;
37923792
37933793 for (Value *V : CS.args()) {
37943794 if (V->getType()->isPointerTy() &&
3795 !CS.paramHasAttr(ArgNo + 1, Attribute::NonNull) &&
3795 !CS.paramHasAttr(ArgNo, Attribute::NonNull) &&
37963796 isKnownNonNullAt(V, CS.getInstruction(), &DT))
37973797 Indices.push_back(ArgNo + 1);
37983798 ArgNo++;
26372637 " Shadow: " << *ArgShadow << "\n");
26382638 bool ArgIsInitialized = false;
26392639 const DataLayout &DL = F.getParent()->getDataLayout();
2640 if (CS.paramHasAttr(i + 1, Attribute::ByVal)) {
2640 if (CS.paramHasAttr(i, Attribute::ByVal)) {
26412641 assert(A->getType()->isPointerTy() &&
26422642 "ByVal argument is not a pointer!");
26432643 Size = DL.getTypeAllocSize(A->getType()->getPointerElementType());
29752975 Value *A = *ArgIt;
29762976 unsigned ArgNo = CS.getArgumentNo(ArgIt);
29772977 bool IsFixed = ArgNo < CS.getFunctionType()->getNumParams();
2978 bool IsByVal = CS.paramHasAttr(ArgNo + 1, Attribute::ByVal);
2978 bool IsByVal = CS.paramHasAttr(ArgNo, Attribute::ByVal);
29792979 if (IsByVal) {
29802980 // ByVal arguments always go to the overflow area.
29812981 // Fixed arguments passed through the overflow area will be stepped
34963496 Value *A = *ArgIt;
34973497 unsigned ArgNo = CS.getArgumentNo(ArgIt);
34983498 bool IsFixed = ArgNo < CS.getFunctionType()->getNumParams();
3499 bool IsByVal = CS.paramHasAttr(ArgNo + 1, Attribute::ByVal);
3499 bool IsByVal = CS.paramHasAttr(ArgNo, Attribute::ByVal);
35003500 if (IsByVal) {
35013501 assert(A->getType()->isPointerTy());
35023502 Type *RealTy = A->getType()->getPointerElementType();
312312 // Try to mark pointer typed parameters as non-null. We skip the
313313 // relatively expensive analysis for constants which are obviously either
314314 // null or non-null to start with.
315 if (Type && !CS.paramHasAttr(ArgNo + 1, Attribute::NonNull) &&
315 if (Type && !CS.paramHasAttr(ArgNo, Attribute::NonNull) &&
316316 !isa(V) &&
317317 LVI->getPredicateAt(ICmpInst::ICMP_EQ, V,
318318 ConstantPointerNull::get(Type),
4141 EXPECT_TRUE(Call->isTailCall()) << "Indirect call from stub should be tail call.";
4242 EXPECT_TRUE(Call->hasStructRetAttr())
4343 << "makeStub should propagate sret attr on 1st argument.";
44 EXPECT_TRUE(Call->paramHasAttr(2U, Attribute::ByVal))
44 EXPECT_TRUE(Call->paramHasAttr(1U, Attribute::ByVal))
4545 << "makeStub should propagate byval attr on 2nd argument.";
4646 }
4747