[PATCH] D46671: Use iteration instead of recursion in CFIInserter

Sanjoy Das via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 9 18:54:25 PDT 2018


sanjoy marked an inline comment as done.
sanjoy added inline comments.


================
Comment at: lib/CodeGen/CFIInstrInserter.cpp:225-228
+  SmallVector<MachineBasicBlock *, 4> Stack(MBBInfo.MBB->successors().begin(),
+                                            MBBInfo.MBB->successors().end());
+
+  while (!Stack.empty()) {
----------------
dberris wrote:
> Does this change the order of iteration here? It looks like because you're using a stack and going from the top of the stack, it's slightly different from the BFS nature of the recursion, no?
> 
> Some questions: does it matter, and if it does, maybe use a queue?
I didn't worry about this too much since no tests broke.

Having said that, I don't know if it matters.  In fact I don't know this code at all.  I'm hoping the original authors will chime in with any inputs.


Repository:
  rL LLVM

https://reviews.llvm.org/D46671





More information about the llvm-commits mailing list