Changes in directory llvm/lib/Transforms/Scalar:
LoopUnswitch.cpp updated: 1.61 -> 1.62 --- Log message: Do not unswitch loop on same value again and again. --- 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.61 llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.62 --- llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.61 Mon Feb 5 17:32:05 2007 +++ llvm/lib/Transforms/Scalar/LoopUnswitch.cpp Mon Feb 26 13:31:58 2007 @@ -62,6 +62,8 @@ // LoopProcessWorklist - List of loops we need to process. std::vector<Loop*> LoopProcessWorklist; + std::set<Value *> UnswitchedVals; + public: virtual bool runOnFunction(Function &F); bool visitLoop(Loop *L); @@ -186,6 +188,11 @@ // Find a value to unswitch on: // FIXME: this should chose the most expensive case! Constant *UnswitchVal = SI->getCaseValue(1); + // Do not process same value again and again. + if (UnswitchedVals.count(UnswitchVal) != 0) + continue; + UnswitchedVals.insert(UnswitchVal); + if (UnswitchIfProfitable(LoopCond, UnswitchVal, L)) { ++NumSwitches; return true; _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits