[PATCH] D17625: Do not select EhPad BB in MachineBlockPlacement when there is regular BB to schedule

Chandler Carruth via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 2 22:50:06 PST 2016


chandlerc added inline comments.

================
Comment at: lib/CodeGen/MachineBlockPlacement.cpp:545
@@ -543,1 +544,3 @@
 
+    // We prefer non ehpad over ehpads.
+    bool IsCandidateEHPad = MBB->isEHPad();
----------------
davidxl wrote:
> The new code really lowers the readability. Can you describe the algorithm here? Is it
> 1) if the best non eh block exists, return it; otherwise
> 2) return the least likely eh pad?
> 
> if that is the case, why not simply skip eh blocks in the original worklist loop. If the best bb is found return it, otherwise have another helper loop to find the least likely eh pad?
I agree that this makes it essentially unreadable. =/

I'd suggest instead to maintain two worklists, one of non-EH-pads, and another of EH-pads. Then you can write the direct loop over each, and you can even put the algorithm David suggested in a comment on the second loop. =]

Note that looping over the worklist twice could be quite expensive, which is why I'd suggest two lists.


http://reviews.llvm.org/D17625





More information about the llvm-commits mailing list