diff options
author | Arnold Schwaighofer <aschwaighofer@apple.com> | 2016-09-10 19:42:53 +0000 |
---|---|---|
committer | Arnold Schwaighofer <aschwaighofer@apple.com> | 2016-09-10 19:42:53 +0000 |
commit | 6c57f4f56dbeea75afe22cd08332d415c2601f37 (patch) | |
tree | 45a4b85ad520d90f04f6fbdb6082bbeefd0bdecd /llvm/lib/IR/Verifier.cpp | |
parent | b1c174aa1c2a4a903b728625f646d075a861ece4 (diff) | |
download | bcm5719-llvm-6c57f4f56dbeea75afe22cd08332d415c2601f37.tar.gz bcm5719-llvm-6c57f4f56dbeea75afe22cd08332d415c2601f37.zip |
It should also be legal to pass a swifterror parameter to a call as a swifterror
argument.
rdar://28233388
llvm-svn: 281147
Diffstat (limited to 'llvm/lib/IR/Verifier.cpp')
-rw-r--r-- | llvm/lib/IR/Verifier.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp index 6e9eb7476a1..ba7db85094e 100644 --- a/llvm/lib/IR/Verifier.cpp +++ b/llvm/lib/IR/Verifier.cpp @@ -2586,15 +2586,20 @@ void Verifier::verifyCallSite(CallSite CS) { } // For each argument of the callsite, if it has the swifterror argument, - // make sure the underlying alloca has swifterror as well. + // make sure the underlying alloca/parameter it comes from has a swifterror as + // well. for (unsigned i = 0, e = FTy->getNumParams(); i != e; ++i) if (CS.paramHasAttr(i+1, Attribute::SwiftError)) { Value *SwiftErrorArg = CS.getArgument(i); - auto AI = dyn_cast<AllocaInst>(SwiftErrorArg->stripInBoundsOffsets()); - Assert(AI, "swifterror argument should come from alloca", AI, I); - if (AI) + if (auto AI = dyn_cast<AllocaInst>(SwiftErrorArg->stripInBoundsOffsets())) { Assert(AI->isSwiftError(), "swifterror argument for call has mismatched alloca", AI, I); + continue; + } + auto ArgI = dyn_cast<Argument>(SwiftErrorArg); + Assert(ArgI, "swifterror argument should come from an alloca or parameter", SwiftErrorArg, I); + Assert(ArgI->hasSwiftErrorAttr(), + "swifterror argument for call has mismatched parameter", ArgI, I); } if (FTy->isVarArg()) { |