[PATCH] D48369: [CodeGen] Make block removal order deterministic in CodeGenPrepare

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 27 08:53:56 PDT 2018


fhahn accepted this revision.
fhahn added a comment.
This revision is now accepted and ready to land.

LGTM, but please wait a bit with committing, in case there are any more comments.



================
Comment at: lib/CodeGen/CodeGenPrepare.cpp:468
+    // are removed.
+    SmallSetVector<BasicBlock*, 8> WorkList;
     for (BasicBlock &BB : F) {
----------------
dstenb wrote:
> fhahn wrote:
> > IIUC  for each BB we look at the successor and only add a successor to the worklist, if it has exactly one predecessor, right? Doesn't that mean we only ever add each BB once and there wouldn't be a need for a set?
> At least with how successors are handled now, we need it to be a set due to switch instructions where multiple cases share the same successor (for example `%bb857.i` in `test/CodeGen/X86/2010-01-11-ExtraPHIArg.ll`).
Right!


https://reviews.llvm.org/D48369





More information about the llvm-commits mailing list