[PATCH] D16912: Improve the C API echo test tool to emit basic block is the right order.

Amaury SECHET via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 9 13:32:01 PST 2016


deadalnix added inline comments.

================
Comment at: tools/llvm-c-test/echo.cpp:220
@@ +219,3 @@
+        LLVMBasicBlockRef SrcBB = LLVMValueAsBasicBlock(LLVMGetOperand(Src, 0));
+        Dst = LLVMBuildBr(Builder, DeclareBB(SrcBB));
+        break;
----------------
DeclareBB is called here for instance.

================
Comment at: tools/llvm-c-test/echo.cpp:368
@@ +367,3 @@
+      LLVMMoveBasicBlockAfter(BB, DeclareBB(Prev));
+    }
+
----------------
joker.eph wrote:
> This is not clear to me that `CloneBB ` will enforce ordering in the absolute: if "Prev" hasn't been encountered yet it may be seen later and will be moved.
> 
> On the opposite if you're relying here on the order in which CloneBB is called, what is the ordering actually doing?
CloneBB will be called in order, but DeclareBB will be called whenever the basic block is needed (for instance, because it is the destination of a branch).


http://reviews.llvm.org/D16912





More information about the llvm-commits mailing list