[LLVMbugs] [Bug 14578] New: Apparent miscompilation with opt -inline -sroa/-scalarrepl and llc -O1

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Dec 11 13:52:08 PST 2012


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

             Bug #: 14578
           Summary: Apparent miscompilation with opt -inline
                    -sroa/-scalarrepl and llc -O1
           Product: new-bugs
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: matti.niemenmaa+llvmbugs at iki.fi
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Created attachment 9679
  --> http://llvm.org/bugs/attachment.cgi?id=9679
Testcase

The attached bitcode seems to be getting miscompiled after opt -inline -sroa
and llc -O1, on an x86-64 host. Doing opt -inline and opt -sroa separately
hides the issue.

Since both opt -inline -sroa and llc -O1 are required, I unfortunately have no
idea at what level the bug is. (Aside from the usual miscompilation caveats:
the original code itself could be at fault, or even the backend of Clang.)

I'm sorry about the large bitcode, but reducing this is a royal pain. bugpoint
doesn't help, it just moves the two global constants to a separate bitcode
file. (Or, without -disable-loop-extraction, crashes --- see Bug 14370.)

Results of various kinds of optimizations with LLVM trunk (r169915):

$ llc -O1 < misbehaviour.bc | gcc -x assembler - && ./a.out    
OK

$ opt -inline -sroa < misbehaviour.bc | llc -O0 | gcc -x assembler - && ./a.out 
OK
$ opt -inline -sroa < misbehaviour.bc | llc -O1 | gcc -x assembler - && ./a.out 
zsh: segmentation fault (core dumped)  ./a.out

$ opt -inline < misbehaviour.bc | opt -sroa | llc -O1 | gcc -x assembler - &&
./a.out
OK

$ opt -O3 < misbehaviour.bc | llc -O0 | gcc -x assembler - && ./a.out 
OK
$ opt -O3 < misbehaviour.bc | llc -O1 | gcc -x assembler - && ./a.out 
zsh: segmentation fault (core dumped)  ./a.out

Using -scalarrepl in place of -sroa affects none of these.

The error pointed out by valgrind in the segfaulting cases is "Invalid read of
size 8" on address 0x18.

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



More information about the llvm-bugs mailing list