[PATCH] D18578: Introduce BitSet: A BitVector based class behaving like std::set/DenseSet

Matthias Braun via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 14 17:40:14 PDT 2016

MatzeB added inline comments.

Comment at: include/llvm/ADT/BitSet.h:111
@@ +110,3 @@
+    Vector[Idx] = true;
+    return std::make_pair(iterator(&Vector, Idx), Res);
+  }
joker.eph wrote:
> Again that's 3 queries to the vector instead of one, I wonder if the compiler CSE perfectly the generated code. 
The new version of the code should avoid the advance() calls in the iterator. This is just the way the STL set APIs work, unfortunately this is will always be an extra load and pair<> creation even if most users don't need the return value. You can only hope the compiler inlines properly and throws the return value and extra queries away.



More information about the llvm-commits mailing list