<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix">On 3/4/15 10:13 PM, Yuxi Chen wrote:<br>
    </div>
    <blockquote
cite="mid:83E2887150EB424E8D7877B912AE1FF128AAF19C@xm-mbx-07-prod.ad.uchicago.edu"
      type="cite">
      <meta http-equiv="Context-Type" content="text/html;
        charset=iso-8859-1">
      <div>Hi all,<br>
        <br>
        I am newbie for llvm.  I just create a global variable, there
        are some statements in my pass like:<br>
        <br>
            LoadInst* int64_64 = new LoadInst(pthreadPID, "", false,
        OptAplusOne);<br>
            int64_64->setAlignment(8);<br>
        <br>
            int64_64->dump();<br>
            LoadInst* int32_65 = new LoadInst(gvar_int32_myFlag, "",
        false, OptAplusOne);<br>
            int32_65->setAlignment(4);<br>
        <br>
            int32_65->dump();<br>
        <br>
        But when I run my pass,  it generates an error, I don't know
        why.<br>
        <br>
        @myFlag = global i32 0, align 4<br>
        @myPid = common global [20 x i64] zeroinitializer, align 16 
        //this is the global,
        <br>
          %117 = load i64* %t, align 8<br>
          %118 = load i32* @myFlag, align 4<br>
        While deleting: i32* %myFlag<br>
        Use still stuck around after Def is destroyed:@myFlag = global
        i32 <null operand!>, align 4<br>
        <br>
        I am sure I initialize the global variable myFlag, I don't
        delete this global variable.<br>
        <br>
        Can anyone give some hints, or suggestions? <br>
      </div>
    </blockquote>
    <br>
    What code is printing the "While deleting:" text?  Is it your code
    that prints that, or is it some existing LLVM pass?<br>
    <br>
    It looks like something is trying to remove the myFlag global
    variable, but I don't know what code is trying to do that.  I
    suggest you find that code and figure out why it's trying to remove
    a global variable that you're still using.<br>
    <br>
    Regards,<br>
    <br>
    John Criswell<br>
    <br>
    <blockquote
cite="mid:83E2887150EB424E8D7877B912AE1FF128AAF19C@xm-mbx-07-prod.ad.uchicago.edu"
      type="cite">
      <div>
        <br>
        Yuxi<br>
        <br>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
LLVM Developers mailing list
<a class="moz-txt-link-abbreviated" href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>         <a class="moz-txt-link-freetext" href="http://llvm.cs.uiuc.edu">http://llvm.cs.uiuc.edu</a>
<a class="moz-txt-link-freetext" href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a>
</pre>
    </blockquote>
    <br>
    <br>
    <pre class="moz-signature" cols="72">-- 
John Criswell
Assistant Professor
Department of Computer Science, University of Rochester
<a class="moz-txt-link-freetext" href="http://www.cs.rochester.edu/u/criswell">http://www.cs.rochester.edu/u/criswell</a></pre>
  </body>
</html>