<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - ExtractGV externalizes private strings"
   href="https://llvm.org/bugs/show_bug.cgi?id=31674">31674</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>ExtractGV externalizes private strings
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Windows NT
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Interprocedural Optimizations
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>davide@freebsd.org
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>bigcheesegs@gmail.com, llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Testcase:

$ cat test.ll
@.str.47 = private unnamed_addr constant [10 x i8] c"anonymous\00", align 1

define i32 @patatino(i8* nonnull %myptr) {
  %blah = call i32 @strcmp(i8* nonnull %myptr, i8* getelementptr inbounds ([10
x i8], [10 x i8]* @.str.47, i64 0, i64 0))
  ret i32 %blah
}

declare i32 @strcmp(i8* nocapture, i8* nocapture) local_unnamed_addr

$ ./llvm-extract patatino.ll -func=patatino -S
; ModuleID = 'patatino.ll'
source_filename = "patatino.ll"

@.str.47 = external hidden unnamed_addr constant [10 x i8], align 1

define i32 @patatino(i8* nonnull %myptr) {
  %blah = call i32 @strcmp(i8* nonnull %myptr, i8* getelementptr inbounds ([10
x i8], [10 x i8]* @.str.47, i64 0, i64 0))
  ret i32 %blah
}

declare i32 @strcmp(i8* nocapture, i8* nocapture) local_unnamed_addr

In the output, @.str.47 should be extracted (found out while reducing an
optimization bug and moving a given function to its own object file, and
observing a link failure because the private string was internalized and the
linker wasn't able to resolve the symbol).</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>