[PATCH] D22777: GVN-hoist: use a DFS numbering of instructions (PR28670)

Daniel Berlin via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 25 14:16:32 PDT 2016


dberlin added inline comments.

================
Comment at: llvm/lib/Transforms/Scalar/GVNHoist.cpp:787
@@ -793,1 +786,3 @@
+      // DFS numbers change when instructions are hoisted: clear and recompute.
+      DFSNumber.clear();
     }
----------------
Oh, this is the part i forgot :)
Oh well.

One thought:

If we are always inserting at the end of a block (i didn't look), btw, we'd be better off having a per-block numbering.

If we make "I" (here) a member variable called LastDFSNumber, we can then just update the per-block numberings by using ++LastDFSNumber as the number for the hoisted instruction. This avoids walking the instruction stream again on every iteration.




================
Comment at: llvm/test/Transforms/GVN/hoist.ll:638
@@ +637,3 @@
+; CHECK-NEXT: getelementptr
+; CHECK-NEXT: getelementptr
+; CHECK-NEXT: store
----------------
So wait, this hoists more than we did before?


https://reviews.llvm.org/D22777





More information about the llvm-commits mailing list