[llvm-commits] [llvm] r75578 - in /llvm/trunk: include/llvm/Analysis/LoopInfo.h lib/Analysis/LoopInfo.cpp
Duncan Sands
baldrick at free.fr
Wed Jul 15 01:46:42 PDT 2009
Hi Dan,
> + /// makeLoopInvariant - If the given value is an instruciton inside of the
instruciton -> instruction
> +bool Loop::makeLoopInvariant(Instruction *I, Instruction *InsertPt) const {
> + // Test if the value is already loop-invariant.
> + if (isLoopInvariant(I))
> + return true;
> + // Don't hoist instructions with side-effects.
> + if (I->isTrapping())
> + return false;
Are you sure you don't want I->mayHaveSideEffects()?
That tests for instructions that write to memory or throw
an exception (control flow side-effect). I notice that
mayHaveSideEffects is not testing isTrapping(), but that
looks like a mistake. I'm not sure what isTrapping means
exactly - maybe it should somehow be merged with mayThrow,
and turned into a "has control-flow side-effect" predicate.
Ciao,
Duncan.
More information about the llvm-commits
mailing list