[PATCH] Improvements to SSA construction

Quentin Colombet qcolombet at apple.com
Mon Apr 6 11:54:52 PDT 2015


Hi Cameron,

Sounds good.

Let us wait the complete testing from Daniel before reviewing the patch.

Thanks,
-Quentin
> On Apr 6, 2015, at 11:27 AM, Cameron Zwarich <zwarich at apple.com> wrote:
> 
> It was pointed out to me (without any specifics) that the iterated dominance frontier algorithm in PromoteMemoryToRegister.cpp has O(n^2) worst case behavior.
> 
> I inspected the code and think I found the cause. The code uses a priority queue and a worklist, which share the same visited set, but the visited set is only updated when inserting into the priority queue. The original Sreedhar-Gao paper effectively has a second visited set (the InPhi flag) which is used for the priority queue, and the set called Visited is used for the recursive traversal that is done here with a worklist.
> 
> I’ve attached two patches, one which just adds a second visited sit, and another which leverages the fact that one of the visited sets is actually the IDF. I would prefer the latter if it has equal performance with the first.
> 
> They both pass `make check`, but I’m not sure I’ll have time to give these patches the testing they’ll deserve in the next few days. Daniel Berlin has offered to test them more thoroughly for me.
> 
> Note that there is still one difference with the paper. The paper uses a custom linked data structure instead of a priority queue, which takes advantage of the property that the level of all nodes being inserted is at most the current level. The code in LLVM uses a priority queue based on a binary heap. This means that the worst case is O(n log n), but I’d be surprised if the difference matters in practice.
> 
> Cameron
> 
> <idf-faster-a.patch><idf-faster-b.patch>_______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits





More information about the llvm-commits mailing list