[llvm-commits] [llvm] r42075 - in /llvm/trunk: lib/Transforms/Scalar/LICM.cpp test/Transforms/LICM/2007-09-17-PrompteValue.ll

Dan Gohman djg at cray.com
Wed Sep 19 09:49:14 PDT 2007


> 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.



More information about the llvm-commits mailing list