[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 20 15:44:30 PDT 2016


davidxl added inline comments.

================
Comment at: lib/Transforms/Instrumentation/IndirectCallPromotion.cpp:378
@@ +377,3 @@
+  // Add jump from Merge BB to the NormalDest.
+  BranchInst::Create(II->getNormalDest(), *MergeBB);
+}
----------------
Do you need merge BB here for invoke at all (which will be empty and unreachable)?

================
Comment at: lib/Transforms/Instrumentation/IndirectCallPromotion.cpp:439
@@ +438,3 @@
+    II->mutateFunctionType(DirectCallee->getFunctionType());
+    II->setNormalDest(NormalDest);
+  }
----------------
if you remove MergeBB, there is no need for this step -- or this is needed to avoid fixing up phis in the original normal dest?

================
Comment at: lib/Transforms/Instrumentation/IndirectCallPromotion.cpp:445
@@ +444,3 @@
+
+  NewInst->setMetadata(LLVMContext::MD_prof, 0);
+  CallSite NewCS(NewInst);
----------------
add comment -- clear the value profile data.

================
Comment at: lib/Transforms/Instrumentation/IndirectCallPromotion.cpp:555
@@ +554,3 @@
+                                       Inst);
+  Instruction *DirectCallResult =
+      insertCallRetCast(Inst, NewInst, DirectCallee);
----------------
Can this be folded into create4DirectCallInst call?


http://reviews.llvm.org/D17864





More information about the llvm-commits mailing list