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

            Bug ID: 24394
           Summary: Bad optimized LLVM IR generation after PowerPC
                    optimization using  llopt -O2
           Product: new-bugs
           Version: 3.7
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: unassignedb...@nondot.org
          Reporter: matt.da...@pgroup.com
                CC: llvm-bugs@lists.llvm.org
    Classification: Unclassified

Created attachment 14709
  --> https://llvm.org/bugs/attachment.cgi?id=14709&action=edit
Source, non-llopt, and llopt llvm IR

I have a simple TLS test case in C.  This test runs to completion when
assembled in llvm 3.6 with llopt at -O2, or in 3.7 NOT using opt -O2.  However,
when assembled when building the code using llc 3.7 with llopt -O2 a reference
to a local variable creates a segmentation fault.

I have the offending code in LLVM IR attached (code generated before and after
opt -O2).  I also have the original C source that was used to generate the llvm
ir.  I have stripped the llvm ir samples, making them more readable.

What you will see is that opt removed the assignment of the integer value, 10,
to the TLS variable "x"

Additionally, the TLS variable "x" has been converted from i32 to i1:
Before llopt:
@x = internal thread_local  global i32 100, align 4

After llopt:
@x = internal thread_local unnamed_addr global i1 false

Works:
llvm/3.7/bin/llc ./test.ll -mcpu=native -O2 -post-RA-scheduler=0
-relocation-model=pic -o ./test.s

/usr/bin/as ./test.s -mpower8 -many -o test.o


Fails:
llvm/3.7/bin/opt -O2 ./test.ll -S -o ./test_opt.ll

llvm/3.7/bin/llc ./test_opt.ll -mcpu=native -O2 -post-RA-scheduler=0
-relocation-model=pic -o ./test_opt.s

/usr/bin/as ./test_opt.s -mpower8 -many -o test_opt.o

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to