[PATCH] D47874: [SCEVExpander] Ignore dbg info when finding insertion point.

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 8 14:17:03 PDT 2018


fhahn added a comment.

In https://reviews.llvm.org/D47874#1126869, @davide wrote:

> In https://reviews.llvm.org/D47874#1125517, @fhahn wrote:
>
> > In https://reviews.llvm.org/D47874#1125474, @efriedma wrote:
> >
> > > Not sure this is the best fix.  The function is named findInsertPointAfter; from the name, I would expect it to behave similarly to BasicBlock::getFirstInsertionPt (which does not try to move past debug info).
> > >
> > > We added instructionsWithoutDebug recently to deal with this sort of issue, but it's not directly usable here.
> >
> >
> > Yeah, maybe we should have a function that takes an iterator and advances the iterator to the first non debug/meta instruction?
>
>
> I think so, we could also refactor https://reviews.llvm.org/rL334317 to be less cumbersome.
>  Are you going to work on this or you want me to? [I suspect we're going to find more places where we need the utility so the sooner we get this done, the better].


Something straight forward would be to just add something like the `skipDebug` below as a static function to BasicBlock, similar to `instructionsWithoutDebug`

  +BasicBlock::iterator BasicBlock::skipDebug(iterator Iter) {
  +  while (isa<DbgInfoIntrinsic>(*Iter))
  +    Iter++;
  +  return Iter;
  +}

I am happy to add something like that, but I will only get around to that early next week I guess. Maybe it would be even better to have this helper skip all 'meta' instructions that are not supposed to have an impact on codegen and also adopt `instructionsWithoutDebug`. Otherwise those issues will just keep popping up for various kinds of such instructions.


https://reviews.llvm.org/D47874





More information about the llvm-commits mailing list