CopyForwarding: We need to check whether an argument is a function argument before checking its convention

This commit is contained in:
Arnold Schwaighofer
2016-02-17 14:21:43 -08:00
parent fd566d92bd
commit 2f81e4eaf8
2 changed files with 22 additions and 0 deletions

View File

@@ -93,6 +93,8 @@ static llvm::cl::opt<bool> EnableDestroyHoisting("enable-destroyhoisting",
/// (2) A local alloc_stack variable.
static bool isIdentifiedSourceValue(SILValue Def) {
if (SILArgument *Arg = dyn_cast<SILArgument>(Def)) {
if (!Arg->isFunctionArg())
return false;
// Check that the argument is passed as an in type. This means there are
// no aliases accessible within this function scope.
ParameterConvention Conv = Arg->getParameterInfo().getConvention();