[PATCH] D26256: [InstCombine] Don't set debug location when folding through a phi node

Robert Lougher via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 6 10:53:47 PST 2016


rob.lougher updated this revision to Diff 80445.
rob.lougher added a comment.

I have updated the patch to add a new API for merging debug locations.  As explained in the comments, the API is currently a stub which simply uses an empy location.

The obvious case to consider is when the two debug locations are the same (e.g. instructions on the same line without discriminators).  This could be handled with something like:

  static DILocation *getMergedLocation(const DILocation *LocA,
                                        const DILocation *LocB) {
    return LocA.canDiscriminate(LocB) ? nullptr : LocA;
   }

However, canDiscriminate is incomplete as it only checks filename and line, so I decided to leave it as a pure stub to keep the patch simple.  A later fix can address this.

Also to keep the patch simple I have avoided refactoring the FoldPHIArgXIntoPHI() functions, opting instead to simply replacing the calls to FirstInst->getDebugLoc() with a call to a helper that returns the merged location for the PHI node.

Please let me know if this revision is OK to commit.  As suggested in a previous comment, alhough this is shown as a single patch I'll probably submit it as a series of commits.

Thanks,
Rob.


https://reviews.llvm.org/D26256

Files:
  include/llvm/IR/DebugInfoMetadata.h
  lib/Transforms/InstCombine/InstCombineInternal.h
  lib/Transforms/InstCombine/InstCombinePHI.cpp
  test/DebugInfo/Generic/instcombine-phi.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D26256.80445.patch
Type: text/x-patch
Size: 18587 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161206/6d6d7a41/attachment.bin>


More information about the llvm-commits mailing list