Skip to content
  • Jason Ekstrand's avatar
    nir/lower_variables: Use a real dominance DFS for variable renaming · bc073585
    Jason Ekstrand authored
    
    
    Previously, we were just iterating over the program "in order" which
    kind-of approximates a DFS, but not really.  In particular, we got the
    following case wrong:
    
    loop {
       a = 3;
       if (foo) {
          a = 5;
       } else {
          break;
       }
       use(a);
    }
    
    where use(a) would get 3 instead of 5 because of premature popping of the
    SSA def stack.  Now, since we do an actaul DFS, we should evaluate use(a)
    immediately after a = 5 and we should be ok.
    
    Reviewed-by: default avatarConnor Abbott <cwabbott0@gmail.com>
    bc073585