> Exactly, that's what I meant to say when I said "when loop  
> conditionals are runtime dependent". To ensure safety in  
> PromoteValuesInLoop(), one needs to prove that basic-block is executed  
> at least once. The question is how ?

The most general way to do this is to convert loops like this:

  while (x) {
    body;
  }

to this:

  if (x) {
    do {
      body;
    } while (x);
  }

In the second form, code hoisted/sunk/promoted out of the loop will
still be under the guard of the if. Also see tree-ssa-loop-ch.c in GCC,
for example.

Dan

-- 
Dan Gohman, Cray Inc.
_______________________________________________
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

Reply via email to