From 55ef4340f7c4592eb2aa02cb8ec3e68444fd2ea4 Mon Sep 17 00:00:00 2001 From: windclarion Date: Wed, 20 May 2020 09:10:50 +0800 Subject: [PATCH] [BYOC][MergeComposite] if root->args[i] isn't a CallNode, then Donwcast will check fail (#5623) we needn't execute L131 "call_map->Set(arg, new_arg)", because when arg is CallNode and root->args[i] is not CallNode, new_arg will be a null pointer. There is no point in caching null pointer. Signed-off-by: windclarion --- src/relay/transforms/merge_composite.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/relay/transforms/merge_composite.cc b/src/relay/transforms/merge_composite.cc index b9eef746591b..596e2a1a29eb 100644 --- a/src/relay/transforms/merge_composite.cc +++ b/src/relay/transforms/merge_composite.cc @@ -121,7 +121,7 @@ class MergeCompositeWrapper : public ExprMutator { Array new_args; for (const auto& arg : pattern->args) { Expr new_arg; - if (arg->IsInstance()) { + if (arg->IsInstance() && root->args[i]->IsInstance()) { new_arg = ExtractPattern(Downcast(arg), Downcast(root->args[i]), var_map, call_map); // if we've already processed this call node, return the previous result