[PATCH] D17864: [PGO] Promote indirect calls to conditional direct calls with value-profile
Mehdi AMINI via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 22 22:41:02 PDT 2016
joker.eph added inline comments.
================
Comment at: lib/Transforms/Instrumentation/PGOInstrumentation.cpp:1140
@@ +1139,3 @@
+ BasicBlock::iterator It(NewInst);
+ Instruction *NextInst = &*(++It);
+ NewInst = new BitCastInst(NewInst, CallRetType, "", NextInst);
----------------
joker.eph wrote:
> xur wrote:
> > silvas wrote:
> > > std::next (or llvm::next, if we can't use std::next yet).
> > >
> > > I.e.
> > >
> > > ```
> > > if (FuncRetType != CallRetType)
> > > NewInst = new BitCastInst(NewInst, CallRetType, "", std::next(NewInst));
> > > ```
> > >
> > > Also, I see you are using IRBuilder above. Any reason why IRBuilder is not preferred for the IR building later in the function?
> > No particular reason that I don't use IRbuilder. The inserted instructions are not in different BBs (not with the original call inst). I just thought it's convenient to change the code stream directly.
> The IRBuilder has the nice property that you can supply a name for the instruction and it'll show up only in debug build.
Just a note: forget the comment above on the IRBuilder, this has changed recently and names are handled dynamically in the Context now.
http://reviews.llvm.org/D17864
More information about the llvm-commits
mailing list