[PATCH] D26634: Make block placement determinisatic

David Li via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 14 14:35:03 PST 2016


davidxl added inline comments.


================
Comment at: lib/CodeGen/MachineBlockPlacement.cpp:1498
+   // matching clang binary in bootstrap build.
+   for (MachineBasicBlock &LoopBB : *F)
+     if (LoopBlockSet.count(&LoopBB))
----------------
mkuper wrote:
> davidxl wrote:
> > This fix has compile time implication. Two alternatives:
> > 1) make collectLoopBlockSet to also compute a vector of blocks in fixed order
> > or
> > 2) change BlockFilterSet to be a set of integers where the integer is MBB's unique id: getNumber()
> Another alternative is to change BlockFilterSet to be a SetVector instead of a SmallPtrSet.
> ("The drawback of SetVector is that it requires twice as much space as a normal set and has the sum of constant factors from the set-like container and the sequential container that it uses. Use it only if you need to iterate over the elements in a deterministic order")
> 
> Or is it also too expensive in this case?
Dannyb also made the same suggestion. I think SetVector is basically that is needed.


https://reviews.llvm.org/D26634





More information about the llvm-commits mailing list