[llvm-bugs] [Bug 31674] New: ExtractGV externalizes private strings

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Jan 17 18:17:38 PST 2017


https://llvm.org/bugs/show_bug.cgi?id=31674

            Bug ID: 31674
           Summary: ExtractGV externalizes private strings
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: Interprocedural Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: davide at freebsd.org
                CC: bigcheesegs at gmail.com, llvm-bugs at lists.llvm.org
    Classification: Unclassified

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).

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20170118/3cca9438/attachment.html>


More information about the llvm-bugs mailing list