<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><meta http-equiv="Content-Type" content="text/html charset=us-ascii" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">I'll certainly take a look (but note that I'm at WWDC this week and may not get to this until Monday-ish).<div class=""><br class=""></div><div class="">-- adrian<br class=""><div class=""><blockquote type="cite" class=""><div class="">On Jun 9, 2017, at 10:29 AM, David Blaikie <<a href="mailto:dblaikie@gmail.com" class="">dblaikie@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">+ Adrian to take a look<br class=""><br class=""><div class="gmail_quote"><div dir="ltr" class="">On Thu, Jun 8, 2017 at 4:06 PM Matthew O'Connor via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a>> wrote:<br class=""></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr" class="">Thank you. What I need to do to address this? Open an issue on <a href="http://bugs.llvm.org/" target="_blank" class="">bugs.llvm.org</a>? I'm not sure what the fix needs to be in the cloner.<br class=""></div><div class="gmail_extra"><br class=""><div class="gmail_quote">On Thu, Jun 8, 2017 at 4:19 PM, Peter Collingbourne <span dir="ltr" class=""><<a href="mailto:peter@pcc.me.uk" target="_blank" class="">peter@pcc.me.uk</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr" class="">There have in the past been bugs in the cloner involving duplicate DICompileUnits (see e.g. <a href="https://reviews.llvm.org/D29240" target="_blank" class="">https://reviews.llvm.org/D29240</a>), this one may need a similar fix.<div class=""><br class=""></div><div class="">Peter</div></div><div class="gmail_extra"><br class=""><div class="gmail_quote"><div class=""><div class="m_405528762710614078h5">On Thu, Jun 8, 2017 at 3:07 PM, Matthew O'Connor via llvm-dev <span dir="ltr" class=""><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank" class="">llvm-dev@lists.llvm.org</a>></span> wrote:<br class=""></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class=""><div class="m_405528762710614078h5"><div dir="ltr" class=""><div class=""><div class=""><div class="">All,<br class=""><br class=""></div>I'm seeing duplication of DICompileUnits in a pass that worked in 3.8. I assume I'm doing something wrong. Would someone be willing to point me in the right direction?<br class=""><br class=""></div>The below minimized pass reproduces my issue in 4.0 with the following error:<br class=""><br class=""><span style="font-family:monospace,monospace" class="">DICompileUnit not listed in <a href="http://llvm.dbg.cu/" target="_blank" class="">llvm.dbg.cu</a><br class="">!1707 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 4.0.0 (tags/RELEASE_400/final)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, imports: !1708)<br class="">dsc-opt: /home/moconnor/Source/<a href="http://carte.gi/" target="_blank" class="">carte.gi</a>t/llvm-carte/llvm-4.0.0/llvm/lib/IR/Verifier.cpp:4500: virtual bool {anonymous}::VerifierLegacyPass::doFinalization(llvm::Module&): Assertion `!V->hasBrokenDebugInfo() && "Module contains invalid debug info"' failed.</span><br class=""><br class=""></div>Pass implementation:<br class=""><div class=""><br class=""><font face="monospace,monospace" class="">#define DEBUG_TYPE "dupl"<br class="">#include "llvm/Pass.h"<br class="">#include "llvm/Support/Debug.h"<br class="">#include "llvm/Support/raw_ostream.h"<br class="">#include "llvm/Transforms/Utils/Cloning.h"<br class="">#include <vector><br class="">using namespace llvm;<br class=""><br class="">struct FunctionDuplication;<br class=""><br class="">namespace llvm {<br class="">void initializeFunctionDuplicationPass(PassRegistry &);<br class="">}<br class=""><br class="">struct FunctionDuplication : public ModulePass {<br class="">  static char ID;<br class="">  FunctionDuplication() : ModulePass(ID) {}<br class=""><br class="">  virtual StringRef getPassName() const override {<br class="">    return "Duplicate every function";<br class="">  }<br class=""><br class="">  virtual void getAnalysisUsage(AnalysisUsage &) const override;<br class=""><br class="">  virtual bool runOnModule(Module &) override;<br class=""><br class="">  Function *duplicate(Module &, Function &Old, FunctionType *NewTy) const;<br class="">};<br class=""><br class="">void FunctionDuplication::getAnalysisUsage(AnalysisUsage &AU) const {<br class="">  ModulePass::getAnalysisUsage(AU);<br class="">}<br class=""><br class="">Function *FunctionDuplication::duplicate(Module &M, Function &Old,<br class="">                                         FunctionType *NewTy) const {<br class="">  Function *New = Function::Create(NewTy, Old.getLinkage(), "", &M);<br class="">  New->setAttributes(Old.getAttributes());<br class="">  New->setCallingConv(Old.getCallingConv());<br class=""><br class="">  // Map old arguments to the new arguments.<br class="">  ValueToValueMapTy VMap;<br class="">  for (auto OldFI = Old.arg_begin(), OldFE = Old.arg_end(),<br class="">            NewFI = New->arg_begin();<br class="">       OldFI != OldFE; ++OldFI, ++NewFI) {<br class="">    Argument &OldA = *OldFI;<br class="">    Argument &NewA = *NewFI;<br class="">    NewA.setName(OldA.getName());<br class="">    VMap[&OldA] = &NewA;<br class="">  }<br class=""><br class="">  SmallVector<ReturnInst *, 16> Returns;<br class="">  CloneAndPruneFunctionInto(New, &Old, VMap, true, Returns);<br class=""><br class="">  return New;<br class="">}<br class=""><br class="">bool FunctionDuplication::runOnModule(Module &M) {<br class="">  DataLayout const &DL = M.getDataLayout();<br class="">  bool Modified = false;<br class=""><br class="">  std::vector<Function *> Functions;<br class="">  for (auto &Fn : M.functions()) {<br class="">    Functions.push_back(&Fn);<br class="">  }<br class=""><br class="">  for (auto *F : Functions) {<br class="">    if (F->size() > 0) {<br class="">      dbgs() << "duplicating " << F->getName() << "\n";<br class=""><br class="">      duplicate(M, *F, F->getFunctionType());<br class="">      Modified = true;<br class="">    }<br class="">  }<br class=""><br class="">  return Modified;<br class="">}<br class=""><br class="">char FunctionDuplication::ID = 0;<br class="">INITIALIZE_PASS(FunctionDuplication, "dupl", "Duplicate every function", false,<br class="">                false)<br class="">ModulePass *createFunctionDuplicationPass(void) {<br class="">  return new FunctionDuplication();<br class="">}<br class=""></font><br class=""></div></div>
<br class=""></div></div>_______________________________________________<br class="">
LLVM Developers mailing list<br class="">
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank" class="">llvm-dev@lists.llvm.org</a><br class="">
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank" class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br class="">
<br class=""></blockquote></div><span class="m_405528762710614078HOEnZb"><font color="#888888" class=""><br class=""><br clear="all" class=""><div class=""><br class=""></div>-- <br class=""><div class="m_405528762710614078m_6430319760989812094gmail_signature" data-smartmail="gmail_signature"><div dir="ltr" class="">-- <div class="">Peter</div></div></div>
</font></span></div>
</blockquote></div><br class=""></div>
_______________________________________________<br class="">
LLVM Developers mailing list<br class="">
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank" class="">llvm-dev@lists.llvm.org</a><br class="">
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank" class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br class="">
</blockquote></div></div>
</div></blockquote></div><br class=""></div></div></body></html>