> If a condition is not inside a loop then the condition is suitable > to loop unswitch candidate for the loop.
I don't understand, why reject unswitching on these values? cases like this should be unswitched: int foo(int arg) { for (..) if (arg) ... } -Chris > > --- > Diffs of the changes: (+7 -0) > > LoopUnswitch.cpp | 7 +++++++ > 1 files changed, 7 insertions(+) > > > Index: llvm/lib/Transforms/Scalar/LoopUnswitch.cpp > diff -u llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.70 llvm/lib/ > Transforms/Scalar/LoopUnswitch.cpp:1.71 > --- llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.70 Tue Jun 5 > 19:21:03 2007 > +++ llvm/lib/Transforms/Scalar/LoopUnswitch.cpp Wed Jun 27 19:44:10 > 2007 > @@ -128,6 +128,13 @@ > static Value *FindLIVLoopCondition(Value *Cond, Loop *L, bool > &Changed) { > // Constants should be folded, not unswitched on! > if (isa<Constant>(Cond)) return false; > + > + // If cond is not in loop then it is not suitable. > + if (Instruction *I = dyn_cast<Instruction>(Cond)) > + if (!L->contains(I->getParent())) > + return 0; > + if (isa<Argument>(Cond)) > + return 0; > > // TODO: Handle: br (VARIANT|INVARIANT). > // TODO: Hoist simple expressions out of loops. > > > > _______________________________________________ > llvm-commits mailing list > llvm-commits@cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits