http://llvm.org/bugs/show_bug.cgi?id=14710

             Bug #: 14710
           Summary: LTO bug on compiling llvm-as
           Product: tools
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: lto
        AssignedTo: [email protected]
        ReportedBy: [email protected]
                CC: [email protected]
    Classification: Unclassified


Attached are .ll files produced in the following manner:

emcc-0-basebc.ll: compile llvm-as to bitcode
emcc-1-opt.ll: run opt on that with -O1
emcc-2-linktime.ll: run opt on that with -strip-debug -disable-inlining
-disable-internalize -internalize -internalize-public-api-list=main
-std-link-opts

The step from 1 to 2 breaks the output. Debugging it, the issue is that

define internal fastcc void @_ZL13CopyStringRefPcN4llvm9StringRefE(i8*
nocapture %Memory, %"class.llvm::StringRef"* nocapture byval align 4 %Data)
nounwind {
  tail call void @emscripten_autodebug_i32(i32 -1, i32 739504) nounwind
  %1 = tail call i8* @_ZNK4llvm9StringRef4dataEv(%"class.llvm::StringRef"*
%Data)
[..]

is transformed into

define internal fastcc void @_ZL13CopyStringRefPcN4llvm9StringRefE(i8*
nocapture %Memory, i8* %Data.0, i32 %Data.1) nounwind {
  %Data = alloca %"class.llvm::StringRef", align 8
  tail call fastcc void @emscripten_autodebug_i32(i32 -1, i32 739504) nounwind
  %1 = tail call fastcc i8*
@_ZNK4llvm9StringRef4dataEv(%"class.llvm::StringRef"* %Data)
[..]

Note how %Data was converted into two separate variables %Data.0 and %Data.1
(StringRefs have two properties, a buffer and a length) by LTO, however, those
two variables are not used, instead %Data is allocated on the stack (and never
assigned to, so it contains random data).

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to