After an if statement, the values from both branches are merged,
        potentially creating more aliasing:

        >>> from pythran import passmanager
        >>> pm = passmanager.PassManager('demo')
        >>> fun = """
        ... def foo(a, b):
        ...     if a: c=a
        ...     else: c=b
        ...     return {c}"""
        >>> module = ast.parse(fun)
        >>> result = pm.gather(Aliases, module)
        >>> Aliases.dump(result, filter=ast.Set)
        {c} => ['|a|', '|b|']

def visit_If(self, node):
        '''
        After an if statement, the values from both branches are merged,
        potentially creating more aliasing:

        >>> from pythran import passmanager
        >>> pm = passmanager.PassManager('demo')
        >>> fun = """
        ... def foo(a, b):
        ...     if a: c=a
        ...     else: c=b
        ...     return {c}"""
        >>> module = ast.parse(fun)
        >>> result = pm.gather(Aliases, module)
        >>> Aliases.dump(result, filter=ast.Set)
        {c} => ['|a|', '|b|']
        '''

        md.visit(self, node)
        self.visit(node.test)
        true_aliases = false_aliases = None

        # first try the true branch
        try:
            tmp = self.aliases.copy()
            for stmt in node.body:
                self.visit(stmt)
            true_aliases = self.aliases
            self.aliases = tmp
        except PythranSyntaxError:
            pass

        # then try the false branch
        try:
            for stmt in node.orelse:
                self.visit(stmt)
            false_aliases = self.aliases
        except PythranSyntaxError:
            pass

        if true_aliases and not false_aliases:
            self.aliases = true_aliases
            try:
                for stmt in node.orelse:
                    self.visit(stmt)
                false_aliases = self.aliases
            except PythranSyntaxError:
                pass

        if false_aliases and not true_aliases:
            self.aliases = false_aliases
            try:
                for stmt in node.body:
                    self.visit(stmt)
                true_aliases = self.aliases
            except PythranSyntaxError:
                pass

        # merge the results from true and false branches
        if false_aliases and true_aliases:
            for k, v in true_aliases.items():
                if k in self.aliases:
                    self.aliases[k] = self.aliases[k].union(v)
                else:
                    assert isinstance(v, (frozenset, set))
                    self.aliases[k] = v
        elif true_aliases:
            self.aliases = true_aliases