Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Meta issue: SSA for variable #3904

Closed
1 of 2 tasks
sklam opened this issue Mar 26, 2019 · 8 comments
Closed
1 of 2 tasks

Meta issue: SSA for variable #3904

sklam opened this issue Mar 26, 2019 · 8 comments
Labels
enhancement feature_request SSA Problem due to SSA (or lack of)

Comments

@sklam
Copy link
Member

sklam commented Mar 26, 2019

Feature request

Use SSA for variables.

  • func_ir.get_definitions() problems
    • problem example:
      def doit(x):
          return x
      
      def bar(pred):
          if pred:
              foo = True
          else:
              foo = False
          # do something with foo
          return doit(foo)
    • because foo has one name in all basic-blocks. Analysis cannot easily tell what local foo definition must be. For instance, if bool(pred)==True, we know that foo == True in the "then" block.
    • Many issues are related to this (what are they?)

Work items:

  • add dominance frontier
  • add phi-node insertion in interpreter.py
@stuartarchibald stuartarchibald added the SSA Problem due to SSA (or lack of) label Apr 16, 2019
@stuartarchibald stuartarchibald changed the title SSA for variable Meta issue: SSA for variable Apr 16, 2019
@guilhermeleobas
Copy link
Collaborator

Hi, I can work on this

@sklam
Copy link
Member Author

sklam commented May 21, 2019

@stuartarchibald, i remember you started looking at this. Can you give us an update?

@guilhermeleobas
Copy link
Collaborator

@sklam, can you point me a direction on the source code? I saw that the dominator tree algorithm is implemented on numba/controlflow.py. I can start implementing the dominance frontier algorithm there.

@stuartarchibald
Copy link
Contributor

@sklam IIRC I've got the dominance frontier and dominator tree and was working on the data flow equations for phi node insertion.

@guilhermeleobas
Copy link
Collaborator

Hi @stuartarchibald, the code for the dominance frontier is in the master branch? I could only find the code to compute the (post)Dominator Tree.

@stuartarchibald
Copy link
Contributor

@guilhermeleobas its not, I just hacked it together locally in the simplest way (form up dominance tree and mask off each vertex in turn) so I could start working on where to put phi nodes. If you are familiar with these concepts and the algorithms involved please feel free to write an implementation, it would be interesting to compare notes/you may well get this finished ahead of me doing it! Thanks.

@guilhermeleobas
Copy link
Collaborator

Cool, I will start working on that as soon as I have some cycles to spare.

@stuartarchibald
Copy link
Contributor

Implemented in #5351, closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement feature_request SSA Problem due to SSA (or lack of)
Projects
None yet
Development

No branches or pull requests

3 participants