[PATCH] D17864: [PGO] Promote indirect calls to conditional direct calls with value-profile

David Li via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 27 11:27:54 PDT 2016


davidxl added inline comments.

================
Comment at: lib/Transforms/Instrumentation/IndirectCallPromotion.cpp:424
@@ +423,3 @@
+    int IX = PHI->getBasicBlockIndex(OrigBB);
+    if (IX == -1)
+      continue;
----------------
xur wrote:
> davidxl wrote:
> > Is this condition possible?
> why not? The operand can come from a basic block other than OrigBB:
> like bb1 (def v_1) --> bb2(invoke) --> bb
>        bb2(def v_2) --> bb
> bb can have a phi(v_1, v_2) in bb.
> The incoming block for the phi with ix 0 is bb1, rather bb2, right?
Sorry -- I misread it :)  WHat I meant is that the loop should have an assert that OrigBB is found in one of the iterations

================
Comment at: lib/Transforms/Instrumentation/IndirectCallPromotion.cpp:428
@@ +427,3 @@
+    PHI->addIncoming(V, IndirectCallBB);
+    PHI->setIncomingBlock(IX, DirectCallBB);
+  }
----------------
xur wrote:
> davidxl wrote:
> > What is the phi arg value for this new incoming block?
> it's the same value as the one from OriginBB: in the two statements, the first only dup the value, and second one rest the incoming bb to DirectCallBB.
IF the value was the value from the original indirect call, should the new value become the result of the direct call?


http://reviews.llvm.org/D17864





More information about the llvm-commits mailing list