Skip to content

Commit

Permalink
[BYOC][MergeComposite] if root->args[i] isn't a CallNode, then Donwca…
Browse files Browse the repository at this point in the history
…st<Call> will check fail (apache#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 <[email protected]>
  • Loading branch information
windclarion authored and Trevor Morris committed Jun 18, 2020
1 parent d5ad8c5 commit ce0dbf5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/relay/transforms/merge_composite.cc
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ class MergeCompositeWrapper : public ExprMutator {
Array<Expr> new_args;
for (const auto& arg : pattern->args) {
Expr new_arg;
if (arg->IsInstance<CallNode>()) {
if (arg->IsInstance<CallNode>() && root->args[i]->IsInstance<CallNode>()) {
new_arg =
ExtractPattern(Downcast<Call>(arg), Downcast<Call>(root->args[i]), var_map, call_map);
// if we've already processed this call node, return the previous result
Expand Down

0 comments on commit ce0dbf5

Please sign in to comment.