Changes in directory llvm/lib/Transforms/Scalar:
LoopUnswitch.cpp updated: 1.62 -> 1.63 --- Log message: Use efficient container SmallPtrSet --- Diffs of the changes: (+4 -3) LoopUnswitch.cpp | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-) Index: llvm/lib/Transforms/Scalar/LoopUnswitch.cpp diff -u llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.62 llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.63 --- llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.62 Mon Feb 26 13:31:58 2007 +++ llvm/lib/Transforms/Scalar/LoopUnswitch.cpp Mon Feb 26 14:22:50 2007 @@ -38,6 +38,7 @@ #include "llvm/Transforms/Utils/Local.h" #include "llvm/Transforms/Utils/BasicBlockUtils.h" #include "llvm/ADT/Statistic.h" +#include "llvm/ADT/SmallPtrSet.h" #include "llvm/ADT/PostOrderIterator.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/Compiler.h" @@ -62,7 +63,7 @@ // LoopProcessWorklist - List of loops we need to process. std::vector<Loop*> LoopProcessWorklist; - std::set<Value *> UnswitchedVals; + SmallPtrSet<Value *,8> UnswitchedVals; public: virtual bool runOnFunction(Function &F); @@ -129,6 +130,7 @@ Changed |= visitLoop(L); } + UnswitchedVals.clear(); return Changed; } @@ -189,9 +191,8 @@ // 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) + if (!UnswitchedVals.insert(UnswitchVal)) continue; - UnswitchedVals.insert(UnswitchVal); if (UnswitchIfProfitable(LoopCond, UnswitchVal, L)) { ++NumSwitches; _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits